8000 Merge branch 'master' into is-json-validator · symfony/symfony@d222487 · GitHub
[go: up one dir, main page]

Skip to content

Commit d222487

Browse files
authored
Merge branch 'master' into is-json-validator
2 parents b8e7c7d + 9610d10 commit d222487

File tree

246 files changed

+3687
-951
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+3687
-951
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ addons:
1313
- ldap-utils
1414
- slapd
1515
- librabbitmq-dev
16+
- zookeeperd
17+
- libzookeeper-mt-dev
1618

1719
env:
1820
global:
@@ -161,6 +163,7 @@ before_install:
161163
tfold ext.mongodb tpecl mongodb-1.5.0 mongodb.so $INI
162164
tfold ext.amqp tpecl amqp-1.9.3 amqp.so $INI
163165
tfold ext.igbinary tpecl igbinary-2.0.6 igbinary.so $INI
166+
tfold ext.zookeeper tpecl zookeeper-0.5.0 zookeeper.so $INI
164167
done
165168
166169
- |

UPGRADE-4.2.md

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
UPGRADE FROM 4.1 to 4.2
22
=======================
33

4+
BrowserKit
5+
----------
6+
7+
* The `Client::submit()` method will have a new `$serverParameters` argument in version 5.0, not defining it is deprecated.
8+
49
Cache
510
-----
611

@@ -37,9 +42,22 @@ DoctrineBridge
3742
* The `lazy` attribute on `doctrine.event_listener` tags was removed.
3843
Listeners are now lazy by default. So any `lazy` attributes can safely be removed from those tags.
3944

45+
DomCrawler
46+
----------
47+
48+
* The `Crawler::children()` method will have a new `$selector` argument in version 5.0, not defining it is deprecated.
49+
50+
Finder
51+
------
52+
53+
* The `Finder::sortByName()` method will have a new `$useNaturalSort` argument in version 5.0, not defining it is deprecated.
54+
4055
Form
4156
----
4257

58+
* The `scale` option of the `IntegerType` is deprecated.
59+
* The `$scale` argument of the `IntegerToLocalizedStringTransformer` is deprecated.
60+
4361
* Deprecated calling `FormRenderer::searchAndRenderBlock` for fields which were already rendered.
4462
Instead of expecting such calls to return empty strings, check if the field has already been rendered.
4563

@@ -57,24 +75,12 @@ Form
5775
{% endfor %}
5876
```
5977

60-
Process
61-
-------
62-
63-
* Deprecated the `Process::setCommandline()` and the `PhpProcess::setPhpBinary()` methods.
64-
* Deprecated passing commands as strings when creating a `Process` instance.
65-
66-
Before:
67-
```php
68-
$process = new Process('ls -l');
69-
```
70-
71-
After:
72-
```php
73-
$process = new Process(array('ls', '-l'));
78+
HttpFoundation
79+
--------------
7480

75-
// alternatively, when a shell wrapper is required
76-
$process = Process::fromShellCommandline('ls -l');
77-
```
81+
* The default value of the "$secure" and "$samesite" arguments of Cookie's constructor
82+
will respectively change from "false" to "null" and from "null" to "lax" in Symfony
83+
5.0, you should define their values explicitly or use "Cookie::create()" instead.
7884

7985
FrameworkBundle
8086
---------------
@@ -86,7 +92,7 @@ FrameworkBundle
8692
* Added support for the SameSite attribute for session cookies. It is highly recommended to set this setting (`framework.session.cookie_samesite`) to `lax` for increased security against CSRF attacks.
8793
* The `Controller` class has been deprecated, use `AbstractController` instead.
8894
* The Messenger encoder/decoder configuration has been changed for a unified Messenger serializer configuration.
89-
95+
9096
Before:
9197
```yaml
9298
framework:
@@ -111,29 +117,29 @@ Messenger
111117
* `EnvelopeItemInterface` doesn't extend `Serializable` anymore
112118
* The `handle` method of the `Symfony\Component\Messenger\Middleware\ValidationMiddleware` and `Symfony\Component\Messenger\Asynchronous\Middleware\SendMessageMiddleware` middlewares now requires an `Envelope` object to be given (because they implement the `EnvelopeAwareInterface`). When using these middleware with the provided `MessageBus`, you will not have to do anything. If you use the middlewares any other way, you can use `Envelope::wrap($message)` to create an envelope for your message.
113119
* `MessageSubscriberInterface::getHandledMessages()` return value has changed. The value of an array item
114-
needs to be an associative array or the method name.
115-
120+
needs to be an associative array or the method name.
121+
116122
Before:
117123
```php
118124
return [
119125
[FirstMessage::class, 0],
120126
[SecondMessage::class, -10],
121127
];
122128
```
123-
129+
124130
After:
125131
```php
126132
yield FirstMessage::class => ['priority' => 0];
127133
yield SecondMessage::class => ['priority => -10];
128134
```
129-
135+
130136
Before:
131137
```php
132138
return [
133139
SecondMessage::class => ['secondMessageMethod', 20],
134140
];
135141
```
136-
142+
137143
After:
138144
```php
139145
yield SecondMessage::class => [
@@ -143,7 +149,30 @@ Messenger
143149
```
144150
* The `EncoderInterface` and `DecoderInterface` interfaces have been replaced by a unified `Symfony\Component\Messenger\Transport\Serialization\SerializerInterface`.
145151
Each interface method have been merged untouched into the `Serializer` interface, so you can simply merge your two implementations together and implement the new interface.
146-
152+
153+
Monolog
154+
-------
155+
156+
* The methods `DebugProcessor::getLogs()`, `DebugProcessor::countErrors()`, `Logger::getLogs()` and `Logger::countErrors()` will have a new `$request` argument in version 5.0, not defining it is deprecated.
157+
158+
Process
159+
-------
160+
161+
* Deprecated the `Process::setCommandline()` and the `PhpProcess::setPhpBinary()` methods.
162+
* Deprecated passing commands as strings when creating a `Process` instance.
163+
164+
Before:
165+
```php
166+
$process = new Process('ls -l');
167+
```
168+
169+
After:
170+
```php
171+
$process = new Process(array('ls', '-l'));
172+
173+
// alternatively, when a shell wrapper is required
174+
$process = Process::fromShellCommandline('ls -l');
175+
```
147176

148177
Security
149178
--------
@@ -171,8 +200,9 @@ SecurityBundle
171200
Serializer
172201
----------
173202

174-
* Relying on the default value (false) of the "as_collection" option is deprecated since 4.2.
203+
* Relying on the default value (false) of the "as_collection" option is deprecated.
175204
You should set it to false explicitly instead as true will be the default value in 5.0.
205+
* The `AbstractNormalizer::handleCircularReference()` method will have two new `$format` and `$context` arguments in version 5.0, not defining them is deprecated.
176206

177207
Translation
178208
-----------
@@ -186,3 +216,4 @@ Validator
186216
* The component is now decoupled from `symfony/translation` and uses `Symfony\Contracts\Translation\TranslatorInterface` instead
187217
* The `ValidatorBuilderInterface` has been deprecated and `ValidatorBuilder` made final
188218
* Deprecated validating instances of `\DateTimeInterface` in `DateTimeValidator`, `DateValidator` and `TimeValidator`. Use `Type` instead or remove the constraint if the underlying model is type hinted to `\DateTimeInterface` already.
219+
* Using the `Bic` constraint without `symfony/intl` is deprecated

UPGRADE-5.0.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
UPGRADE FROM 4.x to 5.0
22
=======================
33

4+
BrowserKit
5+
----------
6+
7+
* The `Client::submit()` method has a new `$serverParameters` argument.
8+
49
Cache
510
-----
611

@@ -49,11 +54,27 @@ DoctrineBridge
4954
* Deprecated injecting `ClassMetadataFactory` in `DoctrineExtractor`, an instance of `EntityManagerInterface` should be
5055
injected instead
5156

57+
DomCrawler
58+
----------
59+
60+
* The `Crawler::children()` method has a new `$selector` argument.
61+
5262
EventDispatcher
5363
---------------
5464

5565
* The `TraceableEventDispatcherInterface` has been removed.
5666

67+
Finder
68+
------
69+
70+
* The `Finder::sortByName()` method has a new `$useNaturalSort` argument.
71+
72+
Form
73+
----
74+
75+
* The `scale` option was removed from the `IntegerType`.
76+
* The `$scale` argument of the `IntegerToLocalizedStringTransformer` was removed.
77+
5778
FrameworkBundle
5879
---------------
5980

@@ -102,6 +123,13 @@ HttpFoundation
102123
* The `$size` argument of the `UploadedFile` constructor has been removed.
103124
* The `getClientSize()` method of the `UploadedFile` class has been removed.
104125
* The `getSession()` method of the `Request` class throws an exception when session is null.
126+
* The default value of the "$secure" and "$samesite" arguments of Cookie's constructor
127+
changed respectively from "false" to "null" and from "null" to "lax".
128+
129+
Monolog
130+
-------
131+
132+
* The methods `DebugProcessor::getLogs()`, `DebugProcessor::countErrors()`, `Logger::getLogs()` and `Logger::countErrors()` have a new `$request` argument.
105133

106134
Process
107135
-------
@@ -144,6 +172,11 @@ SecurityBundle
144172
* The `security.authentication.trust_resolver.anonymous_class` parameter has been removed.
145173
* The `security.authentication.trust_resolver.rememberme_class` parameter has been removed.
146174

175+
Serializer
176+
----------
177+
178+
* The `AbstractNormalizer::handleCircularReference()` method has two new `$format` and `$context` arguments.
179+
147180
Translation
148181
-----------
149182

@@ -166,6 +199,7 @@ Validator
166199
* The component is now decoupled from `symfony/translation` and uses `Symfony\Contracts\Translation\TranslatorInterface` instead
167200
* The `ValidatorBuilderInterface` has been removed and `ValidatorBuilder` is now final
168201
* Removed support for validating instances of `\DateTimeInterface` in `DateTimeValidator`, `DateValidator` and `TimeValidator`. Use `Type` instead or remove the constraint if the underlying model is type hinted to `\DateTimeInterface` already.
202+
* The `symfony/intl` component is now required for using the `Bic` constraint
169203

170204
Workflow
171205
--------

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<env name="LDAP_PORT" value="3389" />
2020
<env name="REDIS_HOST" value="localhost" />
2121
<env name="MEMCACHED_HOST" value="localhost" />
22+
<env name="ZOOKEEPER_HOST" value="localhost" />
2223
</php>
2324

2425
<testsuites>

src/Symfony/Bridge/Monolog/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ CHANGELOG
55
-----
66

77
* added `ProcessorInterface`: an optional interface to allow autoconfiguration of Monolog processors
8+
* The methods `DebugProcessor::getLogs()`, `DebugProcessor::countErrors()`, `Logger::getLogs()`
9+
and `Logger::countErrors()` will have a new `$request` argument in version 5.0, not defining
10+
it is deprecated
811

912
4.1.0
1013
-----

src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function __construct(array $options = array())
6161
'colors' => true,
6262
'multiline' => false,
6363
'level_name_format' => '%-9s',
64+
'ignore_empty_context_and_extra' => true,
6465
), $options);
6566

6667
if (class_exists(VarCloner::class)) {
@@ -101,20 +102,16 @@ public function format(array $record)
101102

102103
$levelColor = self::$levelColorMap[$record['level']];
103104

104-
if ($this->options['multiline']) {
105-
$separator = "\n";
105+
if (!$this->options['ignore_empty_context_and_extra'] || !empty($record['context'])) {
106+
$context = ($this->options['multiline'] ? "\n" : ' ').$this->dumpData($record['context']);
106107
} else {
107-
$separator = ' ';
108-
}
109-
110-
$context = $this->dumpData($record['context']);
111-
if ($context) {
112-
$context = $separator.$context;
108+
$context = '';
113109
}
114110

115-
$extra = $this->dumpData($record['extra']);
116-
if ($extra) {
117-
$extra = $separator.$extra;
111+
if (!$this->options['ignore_empty_context_and_extra'] || !empty($record['extra'])) {
112+
$extra = ($this->options['multiline'] ? "\n" : ' ').$this->dumpData($record['extra']);
113+
} else {
114+
$extra = '';
118115
}
119116

120117
$formatted = strtr($this->options['format'], array(

src/Symfony/Bridge/Monolog/Logger.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ class Logger extends BaseLogger implements DebugLoggerInterface, ResetInterface
2323
{
2424
/**
2525
* {@inheritdoc}
26+
*
27+
* @param Request|null $request
2628
*/
2729
public function getLogs(/* Request $request = null */)
2830
{
31+
if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
32+
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
33+
}
34+
2935
if ($logger = $this->getDebugLogger()) {
3036
return $logger->getLogs(...\func_get_args());
3137
}
@@ -35,9 +41,15 @@ public function getLogs(/* Request $request = null */)
3541

3642
/**
3743
* {@inheritdoc}
44+
*
45+
* @param Request|null $request
3846
*/
3947
public function countErrors(/* Request $request = null */)
4048
{
49+
if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
50+
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
51+
}
52+
4153
if ($logger = $this->getDebugLogger()) {
4254
return $logger->countErrors(...\func_get_args());
4355
}

src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,15 @@ public function __invoke(array $record)
5858

5959
/**
6060
* {@inheritdoc}
61+
*
62+
* @param Request|null $request
6163
*/
6264
public function getLogs(/* Request $request = null */)
6365
{
66+
if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
67+
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
68+
}
69+
6470
if (1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) && isset($this->records[$hash = spl_object_hash($request)])) {
6571
return $this->records[$hash];
6672
}
@@ -74,9 +80,15 @@ public function getLogs(/* Request $request = null */)
7480

7581
/**
7682
* {@inheritdoc}
83+
*
84+
* @param Request|null $request
7785
*/
7886
public function countErrors(/* Request $request = null */)
7987
{
88+
if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
89+
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
90+
}
91+
8092
if (1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) && isset($this->errorCount[$hash = spl_object_hash($request)])) {
8193
return $this->errorCount[$hash];
8294
}

src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public function testVerbosityMapping($verbosity, $level, $isHandling, array $map
6464
$realOutput = $this->getMockBuilder('Symfony\Component\Console\Output\Output')->setMethods(array('doWrite'))->getMock();
6565
$realOutput->setVerbosity($verbosity);
6666
if ($realOutput->isDebug()) {
67-
$log = "16:21:54 $levelName [app] My info message\n[]\n[]\n";
67+
$log = "16:21:54 $levelName [app] My info message\n";
6868
} else {
69-
$log = "16:21:54 $levelName [app] My info message [] []\n";
69+
$log = "16:21:54 $levelName [app] My info message\n";
7070
}
7171
$realOutput
7272
->expects($isHandling ? $this->once() : $this->never())
@@ -149,7 +149,7 @@ public function testWritingAndFormatting()
149149
$output
150150
->expects($this->once())
151151
->method('write')
152-
->with("16:21:54 <fg=green>INFO </> <comment>[app]</> My info message\n[]\n[]\n")
152+
->with("16:21:54 <fg=green>INFO </> <comment>[app]</> My info message\n")
153153
;
154154

155155
$handler = new ConsoleHandler(null, false);

0 commit comments

Comments
 (0)
0