From c73b042044ef26e0d9b7eec2c6ea9db0a74759ef Mon Sep 17 00:00:00 2001 From: Bogdan Scordaliu Date: Tue, 22 Oct 2019 10:54:04 +0200 Subject: [PATCH 001/130] bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form --- src/Symfony/Component/DomCrawler/Form.php | 10 +--------- .../Component/DomCrawler/Tests/FormTest.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/Symfony/Component/DomCrawler/Form.php b/src/Symfony/Component/DomCrawler/Form.php index 87ab31485f397..375ee531c4a0e 100644 --- a/src/Symfony/Component/DomCrawler/Form.php +++ b/src/Symfony/Component/DomCrawler/Form.php @@ -89,10 +89,6 @@ public function getValues() { $values = []; foreach ($this->fields->all() as $name => $field) { - if ($field->isDisabled()) { - continue; - } - if (!$field instanceof Field\FileFormField && $field->hasValue()) { $values[$name] = $field->getValue(); } @@ -115,10 +111,6 @@ public function getFiles() $files = []; foreach ($this->fields->all() as $name => $field) { - if ($field->isDisabled()) { - continue; - } - if ($field instanceof Field\FileFormField) { $files[$name] = $field->getValue(); } @@ -463,7 +455,7 @@ private function initialize() private function addField(\DOMElement $node) { - if (!$node->hasAttribute('name') || !$node->getAttribute('name')) { + if (!$node->hasAttribute('name') || !$node->getAttribute('name') || $node->hasAttribute('disabled')) { return; } diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php index 504a9bd4251d9..50f5a120eaa5f 100644 --- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php @@ -148,12 +148,12 @@ public function testConstructorHandlesFormValues() public function testMultiValuedFields() { $form = $this->createForm('
- - - - - - + + + + + +
'); @@ -216,10 +216,10 @@ public function provideInitializeValues() [], ], [ - 'takes into account disabled input fields', + 'skips disabled input fields', ' ', - ['foo' => ['InputFormField', 'foo']], + [], ], [ 'appends the submitted button value', From c9072c70efcceb151915cd0909ff819a13228d1c Mon Sep 17 00:00:00 2001 From: Leevi Graham Date: Fri, 25 Oct 2019 21:23:51 +1100 Subject: [PATCH 002/130] Check value isset to avoid PHP notice --- src/Symfony/Component/Console/Style/SymfonyStyle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index 4291ada8f6cd6..02e9b471b8e61 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -229,7 +229,7 @@ public function choice($question, array $choices, $default = null) { if (null !== $default) { $values = array_flip($choices); - $default = $values[$default]; + $default = isset($values[$default]) ? $values[$default] : $default; } return $this->askQuestion(new ChoiceQuestion($question, $choices, $default)); From 4939f0e32304329207e4248de35406bfc0c23c61 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Fri, 25 Oct 2019 19:00:46 -0400 Subject: [PATCH 003/130] Fix handling of empty_data's \Closure value in Date/Time form types --- .../Form/Extension/Core/Type/DateTimeType.php | 16 ++++++++-- .../Form/Extension/Core/Type/DateType.php | 30 ++++++++++++++----- .../Form/Extension/Core/Type/TimeType.php | 20 +++++++++++-- .../Extension/Core/Type/DateTimeTypeTest.php | 10 +++++++ .../Extension/Core/Type/DateTypeTest.php | 10 +++++++ .../Extension/Core/Type/TimeTypeTest.php | 10 +++++++ 6 files changed, 83 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php index 04b0221fdc632..6edefd622e477 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php @@ -107,7 +107,17 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'invalid_message_parameters', ])); - if (isset($emptyData['date'])) { + if ($emptyData instanceof \Closure) { + $lazyEmptyData = static function ($option) use ($emptyData) { + return static function (FormInterface $form) use ($emptyData, $option) { + $emptyData = $emptyData($form->getParent()); + + return isset($emptyData[$option]) ? $emptyData[$option] : ''; + }; + }; + + $dateOptions['empty_data'] = $lazyEmptyData('date'); + } elseif (isset($emptyData['date'])) { $dateOptions['empty_data'] = $emptyData['date']; } @@ -126,7 +136,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'invalid_message_parameters', ])); - if (isset($emptyData['time'])) { + if ($emptyData instanceof \Closure) { + $timeOptions['empty_data'] = $lazyEmptyData('time'); + } elseif (isset($emptyData['time'])) { $timeOptions['empty_data'] = $emptyData['time']; } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 464c262c13680..5aea4418b200d 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -81,14 +81,28 @@ public function buildForm(FormBuilderInterface $builder, array $options) // so we need to handle the cascade setting here $emptyData = $builder->getEmptyData() ?: []; - if (isset($emptyData['year'])) { - $yearOptions['empty_data'] = $emptyData['year']; - } - if (isset($emptyData['month'])) { - $monthOptions['empty_data'] = $emptyData['month']; - } - if (isset($emptyData['day'])) { - $dayOptions['empty_data'] = $emptyData['day']; + if ($emptyData instanceof \Closure) { + $lazyEmptyData = static function ($option) use ($emptyData) { + return static function (FormInterface $form) use ($emptyData, $option) { + $emptyData = $emptyData($form->getParent()); + + return isset($emptyData[$option]) ? $emptyData[$option] : ''; + }; + }; + + $yearOptions['empty_data'] = $lazyEmptyData('year'); + $monthOptions['empty_data'] = $lazyEmptyData('month'); + $dayOptions['empty_data'] = $lazyEmptyData('day'); + } else { + if (isset($emptyData['year'])) { + $yearOptions['empty_data'] = $emptyData['year']; + } + if (isset($emptyData['month'])) { + $monthOptions['empty_data'] = $emptyData['month']; + } + if (isset($emptyData['day'])) { + $dayOptions['empty_data'] = $emptyData['day']; + } } if (isset($options['invalid_message'])) { diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index c88bea812bdab..f0b5ac2ac4df8 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -76,7 +76,17 @@ public function buildForm(FormBuilderInterface $builder, array $options) // so we need to handle the cascade setting here $emptyData = $builder->getEmptyData() ?: []; - if (isset($emptyData['hour'])) { + if ($emptyData instanceof \Closure) { + $lazyEmptyData = static function ($option) use ($emptyData) { + return static function (FormInterface $form) use ($emptyData, $option) { + $emptyData = $emptyData($form->getParent()); + + return isset($emptyData[$option]) ? $emptyData[$option] : ''; + }; + }; + + $hourOptions['empty_data'] = $lazyEmptyData('hour'); + } elseif (isset($emptyData['hour'])) { $hourOptions['empty_data'] = $emptyData['hour']; } @@ -143,14 +153,18 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->add('hour', self::$widgets[$options['widget']], $hourOptions); if ($options['with_minutes']) { - if (isset($emptyData['minute'])) { + if ($emptyData instanceof \Closure) { + $minuteOptions['empty_data'] = $lazyEmptyData('minute'); + } elseif (isset($emptyData['minute'])) { $minuteOptions['empty_data'] = $emptyData['minute']; } $builder->add('minute', self::$widgets[$options['widget']], $minuteOptions); } if ($options['with_seconds']) { - if (isset($emptyData['second'])) { + if ($emptyData instanceof \Closure) { + $secondOptions['empty_data'] = $lazyEmptyData('second'); + } elseif (isset($emptyData['second'])) { $secondOptions['empty_data'] = $emptyData['second']; } $builder->add('second', self::$widgets[$options['widget']], $secondOptions); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php index e3f3b729d3ec7..8af524f1fceae 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormInterface; class DateTimeTypeTest extends BaseTypeTest { @@ -608,6 +609,9 @@ public function testSubmitNullUsesDateEmptyData($widget, $emptyData, $expectedDa ]); $form->submit(null); + if ($emptyData instanceof \Closure) { + $emptyData = $emptyData($form); + } $this->assertSame($emptyData, $form->getViewData()); $this->assertEquals($expectedData, $form->getNormData()); $this->assertEquals($expectedData, $form->getData()); @@ -616,11 +620,17 @@ public function testSubmitNullUsesDateEmptyData($widget, $emptyData, $expectedDa public function provideEmptyData() { $expectedData = \DateTime::createFromFormat('Y-m-d H:i', '2018-11-11 21:23'); + $lazyEmptyData = static function (FormInterface $form) { + return $form->getConfig()->getCompound() ? ['date' => ['year' => '2018', 'month' => '11', 'day' => '11'], 'time' => ['hour' => '21', 'minute' => '23']] : '2018-11-11T21:23:00'; + }; return [ 'Simple field' => ['single_text', '2018-11-11T21:23:00', $expectedData], 'Compound text field' => ['text', ['date' => ['year' => '2018', 'month' => '11', 'day' => '11'], 'time' => ['hour' => '21', 'minute' => '23']], $expectedData], 'Compound choice field' => ['choice', ['date' => ['year' => '2018', 'month' => '11', 'day' => '11'], 'time' => ['hour' => '21', 'minute' => '23']], $expectedData], + 'Simple field lazy' => ['single_text', $lazyEmptyData, $expectedData], + 'Compound text field lazy' => ['text', $lazyEmptyData, $expectedData], + 'Compound choice field lazy' => ['choice', $lazyEmptyData, $expectedData], ]; } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index 96c74fe0e4209..cb2c2d0a30bdc 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -13,6 +13,7 @@ use Symfony\Component\Form\ChoiceList\View\ChoiceView; use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormInterface; use Symfony\Component\Intl\Util\IntlTestHelper; class DateTypeTest extends BaseTypeTest @@ -985,6 +986,9 @@ public function testSubmitNullUsesDateEmptyData($widget, $emptyData, $expectedDa ]); $form->submit(null); + if ($emptyData instanceof \Closure) { + $emptyData = $emptyData($form); + } $this->assertSame($emptyData, $form->getViewData()); $this->assertEquals($expectedData, $form->getNormData()); $this->assertEquals($expectedData, $form->getData()); @@ -993,11 +997,17 @@ public function testSubmitNullUsesDateEmptyData($widget, $emptyData, $expectedDa public function provideEmptyData() { $expectedData = \DateTime::createFromFormat('Y-m-d H:i:s', '2018-11-11 00:00:00'); + $lazyEmptyData = static function (FormInterface $form) { + return $form->getConfig()->getCompound() ? ['year' => '2018', 'month' => '11', 'day' => '11'] : '2018-11-11'; + }; return [ 'Simple field' => ['single_text', '2018-11-11', $expectedData], 'Compound text fields' => ['text', ['year' => '2018', 'month' => '11', 'day' => '11'], $expectedData], 'Compound choice fields' => ['choice', ['year' => '2018', 'month' => '11', 'day' => '11'], $expectedData], + 'Simple field lazy' => ['single_text', $lazyEmptyData, $expectedData], + 'Compound text fields lazy' => ['text', $lazyEmptyData, $expectedData], + 'Compound choice fields lazy' => ['choice', $lazyEmptyData, $expectedData], ]; } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php index e89dd8d20c9e1..1f0797f000db4 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php @@ -13,6 +13,7 @@ use Symfony\Component\Form\ChoiceList\View\ChoiceView; use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormInterface; class TimeTypeTest extends BaseTypeTest { @@ -785,6 +786,9 @@ public function testSubmitNullUsesDateEmptyData($widget, $emptyData, $expectedDa ]); $form->submit(null); + if ($emptyData instanceof \Closure) { + $emptyData = $emptyData($form); + } $this->assertSame($emptyData, $form->getViewData()); $this->assertEquals($expectedData, $form->getNormData()); $this->assertEquals($expectedData, $form->getData()); @@ -793,11 +797,17 @@ public function testSubmitNullUsesDateEmptyData($widget, $emptyData, $expectedDa public function provideEmptyData() { $expectedData = \DateTime::createFromFormat('Y-m-d H:i', '1970-01-01 21:23'); + $lazyEmptyData = static function (FormInterface $form) { + return $form->getConfig()->getCompound() ? ['hour' => '21', 'minute' => '23'] : '21:23'; + }; return [ 'Simple field' => ['single_text', '21:23', $expectedData], 'Compound text field' => ['text', ['hour' => '21', 'minute' => '23'], $expectedData], 'Compound choice field' => ['choice', ['hour' => '21', 'minute' => '23'], $expectedData], + 'Simple field lazy' => ['single_text', $lazyEmptyData, $expectedData], + 'Compound text field lazy' => ['text', $lazyEmptyData, $expectedData], + 'Compound choice field lazy' => ['choice', $lazyEmptyData, $expectedData], ]; } } From 2797867ae95f6c532960078b38315ba59bc2c21f Mon Sep 17 00:00:00 2001 From: Arman Hosseini Date: Thu, 2 Jan 2020 00:53:08 +0330 Subject: [PATCH 004/130] Check non-null type for numeric type $maxAge and $sharedAge can both be zero --- .../FrameworkBundle/Controller/TemplateController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php index f72d556f60b51..52086ef8dd223 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php @@ -75,17 +75,17 @@ public function templateAction($template, $maxAge = null, $sharedAge = null, $pr throw new \LogicException('You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.'); } - if ($maxAge) { + if (null !== $maxAge) { $response->setMaxAge($maxAge); } - if ($sharedAge) { + if (null !== $sharedAge) { $response->setSharedMaxAge($sharedAge); } if ($private) { $response->setPrivate(); - } elseif (false === $private || (null === $private && ($maxAge || $sharedAge))) { + } elseif (false === $private || (null === $private && (null !== $maxAge || null !== $sharedAge))) { $response->setPublic(); } From bdf02c0a7ebd160872116ddb1a15528e2f1ba585 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Tue, 14 Jan 2020 09:16:44 +0100 Subject: [PATCH 005/130] [Yaml][Inline] Fail properly on empty object tag and empty const tag --- src/Symfony/Component/Yaml/Inline.php | 15 ++++++- .../Component/Yaml/Tests/InlineTest.php | 43 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 73aba3cb8b0dc..7ad4a64ead967 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -506,7 +506,12 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = [] if ('!php/const' === $key) { $key .= self::parseScalar($mapping, $flags, [':', ' '], $i, false, [], true); - $key = self::evaluateScalar($key, $flags); + if ('!php/const:' === $key && ':' !== $mapping[$i]) { + $key = ''; + --$i; + } else { + $key = self::evaluateScalar($key, $flags); + } } if (':' !== $key && false === $i = strpos($mapping, ':', $i)) { @@ -692,6 +697,10 @@ private static function evaluateScalar($scalar, $flags, $references = []) return null; case 0 === strpos($scalar, '!php/object'): if (self::$objectSupport) { + if (!isset($scalar[12])) { + return false; + } + return unserialize(self::parseScalar(substr($scalar, 12))); } @@ -717,6 +726,10 @@ private static function evaluateScalar($scalar, $flags, $references = []) return null; case 0 === strpos($scalar, '!php/const'): if (self::$constantSupport) { + if (!isset($scalar[11])) { + return ''; + } + $i = 0; if (\defined($const = self::parseScalar(substr($scalar, 11), 0, null, $i, false))) { return \constant($const); diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 54372d69505bc..5b55451e19eb3 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -799,4 +799,47 @@ public function getTestsForOctalNumbers() 'negative octal number' => [-28, '-034'], ]; } + + /** + * @dataProvider phpObjectTagWithEmptyValueProvider + */ + public function testPhpObjectWithEmptyValue($expected, $value) + { + $this->assertSame($expected, Inline::parse($value, Yaml::PARSE_OBJECT)); + } + + public function phpObjectTagWithEmptyValueProvider() + { + return [ + [false, '!php/object'], + [false, '!php/object '], + [false, '!php/object '], + [[false], '[!php/object]'], + [[false], '[!php/object ]'], + [[false, 'foo'], '[!php/object , foo]'], + ]; + } + + /** + * @dataProvider phpConstTagWithEmptyValueProvider + */ + public function testPhpConstTagWithEmptyValue($expected, $value) + { + $this->assertSame($expected, Inline::parse($value, Yaml::PARSE_CONSTANT)); + } + + public function phpConstTagWithEmptyValueProvider() + { + return [ + ['', '!php/const'], + ['', '!php/const '], + ['', '!php/const '], + [[''], '[!php/const]'], + [[''], '[!php/const ]'], + [['', 'foo'], '[!php/const , foo]'], + [['' => 'foo'], '{!php/const: foo}'], + [['' => 'foo'], '{!php/const : foo}'], + [['' => 'foo', 'bar' => 'ccc'], '{!php/const : foo, bar: ccc}'], + ]; + } } From 9cbfad5853d29eaaa9e9796c489fcead7a441fd4 Mon Sep 17 00:00:00 2001 From: Signor Pedro <53906348+signor-pedro@users.noreply.github.com> Date: Wed, 29 Jan 2020 11:07:44 +0100 Subject: [PATCH 006/130] [DependencyInjection] #35505 Fix typo in test name Rename testThrowsExceptionWhenAddServiceOnACompiledContainer to testNoExceptionWhenAddServiceOnACompiledContainer. --- .../DependencyInjection/Tests/ContainerBuilderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 53d62a58d214f..75b9305ff32df 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -1090,7 +1090,7 @@ public function testThrowsExceptionWhenSetServiceOnACompiledContainer() $container->set('a', new \stdClass()); } - public function testThrowsExceptionWhenAddServiceOnACompiledContainer() + public function testNoExceptionWhenAddServiceOnACompiledContainer() { $container = new ContainerBuilder(); $container->compile(); From f7021e4bd4bd3f0fbe6cb119365572699f618a35 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 31 Jan 2020 13:44:59 +0100 Subject: [PATCH 007/130] updated CHANGELOG for 4.4.4 --- CHANGELOG-4.4.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG-4.4.md b/CHANGELOG-4.4.md index ada0c8529e0f5..e5f07b9d13dab 100644 --- a/CHANGELOG-4.4.md +++ b/CHANGELOG-4.4.md @@ -7,6 +7,24 @@ in 4.4 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.4.0...v4.4.1 +* 4.4.4 (2020-01-31) + + * bug #35530 [HttpClient] Fix regex bearer (noniagriconomie) + * bug #35532 [Validator] fix access to uninitialized property when getting value (greedyivan) + * bug #35486 [Translator] Default value for 'sort' option in translation:update should be 'asc' (versgui) + * bug #35305 [HttpKernel] Fix stale-if-error behavior, add tests (mpdude) + * bug #34808 [PhpUnitBridge] Properly handle phpunit arguments for configuration file (biozshock) + * bug #35517 [Intl] Provide more locale translations (ro0NL) + * bug #35518 [Mailer] Fix STARTTLS support for Postmark and Mandrill (fabpot) + * bug #35480 [Messenger] Check for all serialization exceptions during message dec… (Patrick Berenschot) + * bug #35502 [Messenger] Fix bug when using single route with XML config (Nyholm) + * bug #35438 [SecurityBundle] fix ldap_bind service arguments (Ioni14) + * bug #35429 [DI] CheckTypeDeclarationsPass now checks if value is type of parameter type (pfazzi) + * bug #35464 [ErrorHandler] Add debug argument to decide whether debug page is shown or not (yceruto) + * bug #35423 Fixes a runtime error when accessing the cache panel (DamienHarper) + * bug #35428 [Cache] fix checking for igbinary availability (nicolas-grekas) + * bug #35424 [HttpKernel] Check if lock can be released (sjadema) + * 4.4.3 (2020-01-21) * bug #35364 [Yaml] Throw on unquoted exclamation mark (fancyweb) From eac640a21ace5bcce52cb39a1e72e944619c6fe1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 31 Jan 2020 13:45:06 +0100 Subject: [PATCH 008/130] updated VERSION for 4.4.4 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 7650257963b8b..828ba08406626 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '4.4.4-DEV'; + const VERSION = '4.4.4'; const VERSION_ID = 40404; const MAJOR_VERSION = 4; const MINOR_VERSION = 4; const RELEASE_VERSION = 4; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2022'; const END_OF_LIFE = '11/2023'; From e3561cc2a358c2d3c2f215165e971b6bf2bac340 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 31 Jan 2020 13:48:55 +0100 Subject: [PATCH 009/130] bumped Symfony version to 4.4.5 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 828ba08406626..d6c3976e4d237 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '4.4.4'; - const VERSION_ID = 40404; + const VERSION = '4.4.5-DEV'; + const VERSION_ID = 40405; const MAJOR_VERSION = 4; const MINOR_VERSION = 4; - const RELEASE_VERSION = 4; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 5; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2022'; const END_OF_LIFE = '11/2023'; From 5a96cf1df8b68fcb969400535f592f86d0c9a345 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 31 Jan 2020 13:54:52 +0100 Subject: [PATCH 010/130] bumped Symfony version to 5.0.5 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 123d46842ab97..7c2304e52e6e4 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -68,12 +68,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '5.0.4'; - const VERSION_ID = 50004; + const VERSION = '5.0.5-DEV'; + const VERSION_ID = 50005; const MAJOR_VERSION = 5; const MINOR_VERSION = 0; - const RELEASE_VERSION = 4; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 5; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '07/2020'; const END_OF_LIFE = '07/2020'; From e02e74d03661ae2256b9904e2f6b84644733662f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 1 Feb 2020 11:00:56 +0100 Subject: [PATCH 011/130] Update PR template --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0d234d8fe9b7f..57c15178547d8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch? | master for features / 3.4, 4.3, 4.4 or 5.0 for bug fixes +| Branch? | master for features / 3.4, 4.4 or 5.0 for bug fixes | Bug fix? | yes/no | New feature? | yes/no | Deprecations? | yes/no From 963d0cce8695517b4a68f4fe207ad66b684f79e2 Mon Sep 17 00:00:00 2001 From: Julien Falque Date: Sat, 1 Feb 2020 16:21:44 +0100 Subject: [PATCH 012/130] Fix HTTP client config handling --- .../DependencyInjection/Configuration.php | 6 ++--- .../Fixtures/php/http_client_xml_key.php | 22 +++++++++++++++++++ .../Fixtures/xml/http_client_xml_key.xml | 19 ++++++++++++++++ .../Fixtures/yml/http_client_xml_key.yml | 12 ++++++++++ .../FrameworkExtensionTest.php | 15 +++++++++++++ 5 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_xml_key.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/http_client_xml_key.xml create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_xml_key.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 4263acc5dd19c..105695c963d91 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1402,7 +1402,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode) if (!\is_array($config)) { return []; } - if (!isset($config['host'])) { + if (!isset($config['host'], $config['value']) || \count($config) > 2) { return $config; } @@ -1511,7 +1511,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode) if (!\is_array($config)) { return []; } - if (!isset($config['key'])) { + if (!isset($config['key'], $config['value']) || \count($config) > 2) { return $config; } @@ -1541,7 +1541,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode) if (!\is_array($config)) { return []; } - if (!isset($config['host'])) { + if (!isset($config['host'], $config['value']) || \count($config) > 2) { return $config; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_xml_key.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_xml_key.php new file mode 100644 index 0000000000000..64778c61561b6 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_xml_key.php @@ -0,0 +1,22 @@ +loadFromExtension('framework', [ + 'http_client' => [ + 'default_options' => [ + 'resolve' => [ + 'host' => '127.0.0.1', + ], + ], + 'scoped_clients' => [ + 'foo' => [ + 'base_uri' => 'http://example.com', + 'query' => [ + 'key' => 'foo', + ], + 'resolve' => [ + 'host' => '127.0.0.1', + ], + ], + ], + ], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/http_client_xml_key.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/http_client_xml_key.xml new file mode 100644 index 0000000000000..95ef0737f8a02 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/http_client_xml_key.xml @@ -0,0 +1,19 @@ + + + + + + + 127.0.0.1 + + + foo + 127.0.0.1 + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_xml_key.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_xml_key.yml new file mode 100644 index 0000000000000..dc87555a901ae --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_xml_key.yml @@ -0,0 +1,12 @@ +framework: + http_client: + default_options: + resolve: + host: 127.0.0.1 + scoped_clients: + foo: + base_uri: http://example.com + query: + key: foo + resolve: + host: 127.0.0.1 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 2d494932dfd42..25409cd87fe4b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1559,6 +1559,21 @@ public function testHttpClientOverrideDefaultOptions() $this->assertSame($expected, $container->getDefinition('foo')->getArgument(2)); } + public function testHttpClientWithQueryParameterKey() + { + $container = $this->createContainerFromFile('http_client_xml_key'); + + $expected = [ + 'key' => 'foo', + ]; + $this->assertSame($expected, $container->getDefinition('foo')->getArgument(2)['query']); + + $expected = [ + 'host' => '127.0.0.1', + ]; + $this->assertSame($expected, $container->getDefinition('foo')->getArgument(2)['resolve']); + } + public function testHttpClientFullDefaultOptions() { $container = $this->createContainerFromFile('http_client_full_default_options'); From 4cce23d9ca20e447239a42e57137e744a78f65f9 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 1 Feb 2020 16:57:56 +0100 Subject: [PATCH 013/130] [Bridge/PhpUnit] dont conflict with phpunit 4.8 --- src/Symfony/Bridge/PhpUnit/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/PhpUnit/composer.json b/src/Symfony/Bridge/PhpUnit/composer.json index 017793ee4920b..9c0965dfae3e6 100644 --- a/src/Symfony/Bridge/PhpUnit/composer.json +++ b/src/Symfony/Bridge/PhpUnit/composer.json @@ -24,7 +24,7 @@ "symfony/error-handler": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" }, "conflict": { - "phpunit/phpunit": "<5.4.3" + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, "autoload": { "files": [ "bootstrap.php" ], From f4622853819462281753b7dd88ce51ff94db5b0c Mon Sep 17 00:00:00 2001 From: Wouter J Date: Sat, 1 Feb 2020 19:15:26 +0100 Subject: [PATCH 014/130] Show both missing packages in the same error message --- src/Symfony/Bridge/Twig/Mime/NotificationEmail.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php b/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php index b5118b7f08c7b..c9d54d72e95dc 100644 --- a/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php +++ b/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php @@ -41,12 +41,17 @@ class NotificationEmail extends TemplatedEmail public function __construct(Headers $headers = null, AbstractPart $body = null) { + $missingPackages = []; if (!class_exists(CssInlinerExtension::class)) { - throw new \LogicException(sprintf('You cannot use "%s" if the CSS Inliner Twig extension is not available; try running "composer require twig/cssinliner-extra".', static::class)); + $missingPackages['twig/cssinliner-extra'] = ' CSS Inliner'; } if (!class_exists(InkyExtension::class)) { - throw new \LogicException(sprintf('You cannot use "%s" if the Inky Twig extension is not available; try running "composer require twig/inky-extra".', static::class)); + $missingPackages['twig/inky-extra'] = 'Inky'; + } + + if ([] !== $missingPackages) { + throw new \LogicException(sprintf('You cannot use "%s" if the %s Twig extension%s not available; try running "composer require %s".', static::class, implode(' and ', $missingPackages), \count($missingPackages) > 1 ? 's are' : ' is', implode(' ', array_keys($missingPackages)))); } parent::__construct($headers, $body); From 6620f8afd933390813d7a50e8284132c698d55ec Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 2 Feb 2020 16:14:55 +0100 Subject: [PATCH 015/130] [FrameworkBundle] remove mention of the old Controller class --- .../DependencyInjection/FrameworkExtension.php | 2 -- .../RemoveEmptyControllerArgumentLocatorsPass.php | 3 --- .../RemoveEmptyControllerArgumentLocatorsPassTest.php | 4 ++-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 9d356e5aed31e..005086436e80a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -392,8 +392,6 @@ public function load(array $configs, ContainerBuilder $container) ->addTag('controller.argument_value_resolver'); $container->registerForAutoconfiguration(AbstractController::class) ->addTag('controller.service_arguments'); - $container->registerForAutoconfiguration('Symfony\Bundle\FrameworkBundle\Controller\Controller') - ->addTag('controller.service_arguments'); $container->registerForAutoconfiguration(DataCollectorInterface::class) ->addTag('data_collector'); $container->registerForAutoconfiguration(FormTypeInterface::class) diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php index 596b6188f66cb..79e67374b2253 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php @@ -51,9 +51,6 @@ public function process(ContainerBuilder $container) } } if (!$reason) { - // Deprecated since Symfony 4.1. See Symfony\Component\HttpKernel\Controller\ContainerControllerResolver - $controllers[$id.':'.$action] = $argumentRef; - if ('__invoke' === $action) { $controllers[$id] = $argumentRef; } diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php index b5e55bdea9e97..6c840aedca306 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php @@ -49,7 +49,7 @@ public function testProcess() $controllers = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertSame(['c1::fooAction', 'c1:fooAction'], array_keys($controllers)); + $this->assertSame(['c1::fooAction'], array_keys($controllers)); $this->assertSame(['bar'], array_keys($container->getDefinition((string) $controllers['c1::fooAction']->getValues()[0])->getArgument(0))); $expectedLog = [ @@ -73,7 +73,7 @@ public function testInvoke() (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); $this->assertEquals( - ['invokable::__invoke', 'invokable:__invoke', 'invokable'], + ['invokable::__invoke', 'invokable'], array_keys($container->getDefinition((string) $resolver->getArgument(0))->getArgument(0)) ); } From 303f9e5be5176a114ae82e4ed3eeeb15bf329252 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 2 Feb 2020 18:40:04 +0100 Subject: [PATCH 016/130] [HttpClient] fix HttpClientDataCollector when handling canceled responses --- .../HttpClient/DataCollector/HttpClientDataCollector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php b/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php index 96bbe695b92ea..5c3fed50c08d2 100644 --- a/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php +++ b/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php @@ -116,7 +116,7 @@ private function collectOnClient(TraceableHttpClient $client): array unset($info['filetime'], $info['http_code'], $info['ssl_verify_result'], $info['content_type']); - if ($trace['method'] === $info['http_method']) { + if (($info['http_method'] ?? null) === $trace['method']) { unset($info['http_method']); } From e94c3fb87d699cf4a368a1757e0dc5570bfd8e4d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 2 Feb 2020 13:11:51 +0100 Subject: [PATCH 017/130] [Config] dont catch instances of Error --- .../Config/Resource/ClassExistenceResource.php | 2 ++ .../Component/Config/Tests/Fixtures/ParseError.php | 7 +++++++ .../Tests/Resource/ClassExistenceResourceTest.php | 12 ++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 src/Symfony/Component/Config/Tests/Fixtures/ParseError.php diff --git a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php index 685da72850e55..fc0259f418922 100644 --- a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php +++ b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php @@ -92,6 +92,8 @@ public function isFresh($timestamp) } } catch (\Throwable $e) { $exists[1] = $e->getMessage(); + + throw $e; } finally { self::$autoloadedClass = $autoloadedClass; if (!--self::$autoloadLevel) { diff --git a/src/Symfony/Component/Config/Tests/Fixtures/ParseError.php b/src/Symfony/Component/Config/Tests/Fixtures/ParseError.php new file mode 100644 index 0000000000000..6bb2213824830 --- /dev/null +++ b/src/Symfony/Component/Config/Tests/Fixtures/ParseError.php @@ -0,0 +1,7 @@ +assertFalse($res->isFresh(0)); } + + /** + * @requires PHP 7 + */ + public function testParseError() + { + $this->expectException('ParseError'); + + $res = new ClassExistenceResource(ParseError::class, false); + $res->isFresh(0); + } } From 774a16150f544a95a5df7c5e4bf39e3a579e85e5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 3 Feb 2020 09:39:20 +0100 Subject: [PATCH 018/130] Fix merge --- .github/patch-types.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/patch-types.php b/.github/patch-types.php index 2552dec990679..2df0774bec4c6 100644 --- a/.github/patch-types.php +++ b/.github/patch-types.php @@ -27,6 +27,7 @@ case false !== strpos($file, '/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php'): case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/BadFileName.php'): case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/BadParent.php'): + case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/ParseError.php'): case false !== strpos($file, '/src/Symfony/Component/Debug/Tests/Fixtures/'): case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Compiler/OptionalServiceClass.php'): case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ParentNotExists.php'): From 6b02362c5b9e1e49cf934aef2d954c1e7d91452a Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Tue, 28 Jan 2020 01:09:27 +0100 Subject: [PATCH 019/130] [Phpunit] Fix running skipped tests expecting only deprecations --- .../Legacy/SymfonyTestsListenerTrait.php | 4 +++ .../OnlyExpectingDeprecationSkippedTest.php | 34 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/OnlyExpectingDeprecationSkippedTest.php diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php index 54c15b67ceedf..69bbcfc09eab0 100644 --- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php +++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php @@ -222,6 +222,10 @@ public function startTest($test) } } + if (!$test->getTestResultObject()) { + return; + } + $annotations = $Test::parseTestMethodAnnotations(\get_class($test), $test->getName(false)); if (isset($annotations['class']['expectedDeprecation'])) { diff --git a/src/Symfony/Bridge/PhpUnit/Tests/OnlyExpectingDeprecationSkippedTest.php b/src/Symfony/Bridge/PhpUnit/Tests/OnlyExpectingDeprecationSkippedTest.php new file mode 100644 index 0000000000000..593e0b4e14342 --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/Tests/OnlyExpectingDeprecationSkippedTest.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\PhpUnit\Tests; + +use PHPUnit\Framework\TestCase; + +/** + * This test is meant to be skipped. + * + * @requires extension ext-dummy + */ +final class OnlyExpectingDeprecationSkippedTest extends TestCase +{ + /** + * Do not remove this test in the next major versions. + * + * @group legacy + * + * @expectedDeprecation unreachable + */ + public function testExpectingOnlyDeprecations() + { + $this->fail('should never be ran.'); + } +} From 427bc3aa18dc67f0f952ee70dcca362c48463b98 Mon Sep 17 00:00:00 2001 From: Alessandro Chitolina Date: Fri, 31 Jan 2020 18:44:35 +0100 Subject: [PATCH 020/130] [Validator] try to call __get method if property is uninitialized --- .../Validator/Mapping/PropertyMetadata.php | 17 +++++++++++++++-- .../Tests/Fixtures/Entity_74_Proxy.php | 18 ++++++++++++++++++ .../Tests/Mapping/PropertyMetadataTest.php | 15 +++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Component/Validator/Tests/Fixtures/Entity_74_Proxy.php diff --git a/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php b/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php index 872bd067be2be..1adad95b80958 100644 --- a/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php @@ -50,8 +50,21 @@ public function getPropertyValue($object) { $reflProperty = $this->getReflectionMember($object); - if (\PHP_VERSION_ID >= 70400 && !$reflProperty->isInitialized($object)) { - return null; + if (\PHP_VERSION_ID >= 70400 && $reflProperty->hasType() && !$reflProperty->isInitialized($object)) { + // There is no way to check if a property has been unset or if it is uninitialized. + // When trying to access an uninitialized property, __get method is triggered. + + // If __get method is not present, no fallback is possible + // Otherwise we need to catch an Error in case we are trying to access an uninitialized but set property. + if (!method_exists($object, '__get')) { + return null; + } + + try { + return $reflProperty->getValue($object); + } catch (\Error $e) { + return null; + } } return $reflProperty->getValue($object); diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/Entity_74_Proxy.php b/src/Symfony/Component/Validator/Tests/Fixtures/Entity_74_Proxy.php new file mode 100644 index 0000000000000..d74badc7d7f96 --- /dev/null +++ b/src/Symfony/Component/Validator/Tests/Fixtures/Entity_74_Proxy.php @@ -0,0 +1,18 @@ +uninitialized); + } + + public function __get($name) + { + return 42; + } +} diff --git a/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php index 8d9e67881a9dc..8868ec64aac9f 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php @@ -15,11 +15,13 @@ use Symfony\Component\Validator\Mapping\PropertyMetadata; use Symfony\Component\Validator\Tests\Fixtures\Entity; use Symfony\Component\Validator\Tests\Fixtures\Entity_74; +use Symfony\Component\Validator\Tests\Fixtures\Entity_74_Proxy; class PropertyMetadataTest extends TestCase { const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; const CLASSNAME_74 = 'Symfony\Component\Validator\Tests\Fixtures\Entity_74'; + const CLASSNAME_74_PROXY = 'Symfony\Component\Validator\Tests\Fixtures\Entity_74_Proxy'; const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent'; public function testInvalidPropertyName() @@ -66,4 +68,17 @@ public function testGetPropertyValueFromUninitializedProperty() $this->assertNull($metadata->getPropertyValue($entity)); } + + /** + * @requires PHP 7.4 + */ + public function testGetPropertyValueFromUninitializedPropertyShouldNotReturnNullIfMagicGetIsPresent() + { + $entity = new Entity_74_Proxy(); + $metadata = new PropertyMetadata(self::CLASSNAME_74_PROXY, 'uninitialized'); + $notUnsetMetadata = new PropertyMetadata(self::CLASSNAME_74_PROXY, 'notUnset'); + + $this->assertNull($notUnsetMetadata->getPropertyValue($entity)); + $this->assertEquals(42, $metadata->getPropertyValue($entity)); + } } From b52b7b9fd643fff1d17c7204fc3ba55bb5ec8f55 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Sat, 1 Feb 2020 14:25:57 +0100 Subject: [PATCH 021/130] [Translation][Debug] Add installation and minimal example to README --- src/Symfony/Component/Debug/README.md | 14 +++++++++++++- src/Symfony/Component/Translation/README.md | 20 +++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Debug/README.md b/src/Symfony/Component/Debug/README.md index 38bc800c587b3..f0878df3fa38a 100644 --- a/src/Symfony/Component/Debug/README.md +++ b/src/Symfony/Component/Debug/README.md @@ -3,10 +3,22 @@ Debug Component The Debug component provides tools to ease debugging PHP code. +Getting Started +--------------- + +``` +$ composer install symfony/debug +``` + +```php +use Symfony\Component\Debug\Debug; + +Debug::enable(); +``` + Resources --------- - * [Documentation](https://symfony.com/doc/current/components/debug.html) * [Contributing](https://symfony.com/doc/current/contributing/index.html) * [Report issues](https://github.com/symfony/symfony/issues) and [send Pull Requests](https://github.com/symfony/symfony/pulls) diff --git a/src/Symfony/Component/Translation/README.md b/src/Symfony/Component/Translation/README.md index e80a70cad033e..f4f1706675d5a 100644 --- a/src/Symfony/Component/Translation/README.md +++ b/src/Symfony/Component/Translation/README.md @@ -3,10 +3,28 @@ Translation Component The Translation component provides tools to internationalize your application. +Getting Started +--------------- + +``` +$ composer require symfony/translation +``` + +```php +use Symfony\Component\Translation\Translator; + +$translator = new Translator('fr_FR'); +$translator->addResource('array', [ + 'Hello World!' => 'Bonjour !', +], 'fr_FR'); + +echo $translator->trans('Hello World!'); // outputs « Bonjour ! » +``` + Resources --------- - * [Documentation](https://symfony.com/doc/current/components/translation.html) + * [Documentation](https://symfony.com/doc/current/translation.html) * [Contributing](https://symfony.com/doc/current/contributing/index.html) * [Report issues](https://github.com/symfony/symfony/issues) and [send Pull Requests](https://github.com/symfony/symfony/pulls) From 4d920f04d0b2d9cd55fb1ff6201f4c67cc72337f Mon Sep 17 00:00:00 2001 From: Stefan Kruppa Date: Tue, 28 Jan 2020 14:44:57 +0100 Subject: [PATCH 022/130] Fail on empty password verification (without warning on any implementation) --- .../Component/Security/Core/Encoder/NativePasswordEncoder.php | 3 +++ .../Component/Security/Core/Encoder/SodiumPasswordEncoder.php | 3 +++ .../Security/Core/Tests/Encoder/NativePasswordEncoderTest.php | 1 + .../Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php | 1 + 4 files changed, 8 insertions(+) diff --git a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php index 3b158a72f4dd5..cbfe4c0a08032 100644 --- a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php @@ -76,6 +76,9 @@ public function encodePassword($raw, $salt): string */ public function isPasswordValid($encoded, $raw, $salt): bool { + if ('' === $raw) { + return false; + } if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) { return false; } diff --git a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php index 39f41dd99057e..5391361af37fc 100644 --- a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php @@ -76,6 +76,9 @@ public function encodePassword($raw, $salt): string */ public function isPasswordValid($encoded, $raw, $salt): bool { + if ('' === $raw) { + return false; + } if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) { return false; } diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/NativePasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/NativePasswordEncoderTest.php index 965bf3751c7ee..47b8ac09eaa69 100644 --- a/src/Symfony/Component/Security/Core/Tests/Encoder/NativePasswordEncoderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Encoder/NativePasswordEncoderTest.php @@ -53,6 +53,7 @@ public function testValidation() $result = $encoder->encodePassword('password', null); $this->assertTrue($encoder->isPasswordValid($result, 'password', null)); $this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null)); + $this->assertFalse($encoder->isPasswordValid($result, '', null)); } public function testNonArgonValidation() diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php index 8fa0813115e16..2c4527fef7cfb 100644 --- a/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php @@ -29,6 +29,7 @@ public function testValidation() $result = $encoder->encodePassword('password', null); $this->assertTrue($encoder->isPasswordValid($result, 'password', null)); $this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null)); + $this->assertFalse($encoder->isPasswordValid($result, '', null)); } public function testBCryptValidation() From 327ee1a956c3a6b4f6c9a054650dc4020c75f029 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 3 Feb 2020 17:31:58 +0100 Subject: [PATCH 023/130] Fix CS --- .../Component/Security/Core/Encoder/NativePasswordEncoder.php | 1 + .../Component/Security/Core/Encoder/SodiumPasswordEncoder.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php index cbfe4c0a08032..4ffa38d38e3b9 100644 --- a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php @@ -79,6 +79,7 @@ public function isPasswordValid($encoded, $raw, $salt): bool if ('' === $raw) { return false; } + if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) { return false; } diff --git a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php index 5391361af37fc..35291ed31dc7d 100644 --- a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php @@ -79,6 +79,7 @@ public function isPasswordValid($encoded, $raw, $salt): bool if ('' === $raw) { return false; } + if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) { return false; } From a4544c25716b3b886be80462a5bd8de647afdd3b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 3 Feb 2020 17:40:51 +0100 Subject: [PATCH 024/130] Fix CS --- src/Symfony/Bridge/Twig/Mime/NotificationEmail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php b/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php index c9d54d72e95dc..7329163e17bcf 100644 --- a/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php +++ b/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php @@ -50,7 +50,7 @@ public function __construct(Headers $headers = null, AbstractPart $body = null) $missingPackages['twig/inky-extra'] = 'Inky'; } - if ([] !== $missingPackages) { + if ($missingPackages) { throw new \LogicException(sprintf('You cannot use "%s" if the %s Twig extension%s not available; try running "composer require %s".', static::class, implode(' and ', $missingPackages), \count($missingPackages) > 1 ? 's are' : ' is', implode(' ', array_keys($missingPackages)))); } From b72b7d34132b8e954c4caec7accbc8706286aaeb Mon Sep 17 00:00:00 2001 From: Guite Date: Wed, 22 Jan 2020 09:28:22 +0100 Subject: [PATCH 025/130] [Translation] prefer intl domain when adding messages to catalogue --- .../Component/Translation/MessageCatalogue.php | 14 +++++++++++--- .../Tests/Catalogue/TargetOperationTest.php | 13 +++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Translation/MessageCatalogue.php b/src/Symfony/Component/Translation/MessageCatalogue.php index 2bad9c2c2f8ba..cde056a73609a 100644 --- a/src/Symfony/Component/Translation/MessageCatalogue.php +++ b/src/Symfony/Component/Translation/MessageCatalogue.php @@ -158,9 +158,17 @@ public function replace($messages, $domain = 'messages') public function add($messages, $domain = 'messages') { if (!isset($this->messages[$domain])) { - $this->messages[$domain] = $messages; - } else { - foreach ($messages as $id => $message) { + $this->messages[$domain] = []; + } + $intlDomain = $domain; + $suffixLength = \strlen(self::INTL_DOMAIN_SUFFIX); + if (\strlen($domain) > $suffixLength && false !== strpos($domain, self::INTL_DOMAIN_SUFFIX, -$suffixLength)) { + $intlDomain .= self::INTL_DOMAIN_SUFFIX; + } + foreach ($messages as $id => $message) { + if (isset($this->messages[$intlDomain]) && \array_key_exists($id, $this->messages[$intlDomain])) { + $this->messages[$intlDomain][$id] = $message; + } else { $this->messages[$domain][$id] = $message; } } diff --git a/src/Symfony/Component/Translation/Tests/Catalogue/TargetOperationTest.php b/src/Symfony/Component/Translation/Tests/Catalogue/TargetOperationTest.php index 570b503aeabaa..d4608f6ef6311 100644 --- a/src/Symfony/Component/Translation/Tests/Catalogue/TargetOperationTest.php +++ b/src/Symfony/Component/Translation/Tests/Catalogue/TargetOperationTest.php @@ -67,6 +67,19 @@ public function testGetResultFromIntlDomain() ); } + public function testGetResultWithMixedDomains() + { + $this->assertEquals( + new MessageCatalogue('en', [ + 'messages+intl-icu' => ['a' => 'old_a'], + ]), + $this->createOperation( + new MessageCatalogue('en', ['messages' => ['a' => 'old_a']]), + new MessageCatalogue('en', ['messages+intl-icu' => ['a' => 'new_a']]) + )->getResult() + ); + } + public function testGetResultWithMetadata() { $leftCatalogue = new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]); From fbfe1ed42383b46c7c0fc707d01e2f6b7126f8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vilius=20Grigali=C5=ABnas?= Date: Mon, 6 Jan 2020 17:36:06 +0200 Subject: [PATCH 026/130] [Mailer] Fix broken mandrill http send for recipients with names --- .../Mailchimp/Http/MandrillTransport.php | 71 +++++++++++++++++++ .../Transport/MandrillHttpTransport.php | 14 +++- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php new file mode 100644 index 0000000000000..b6b3bef07e766 --- /dev/null +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Mailer\Bridge\Mailchimp\Http; + +use Psr\Log\LoggerInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Mailer\Exception\TransportException; +use Symfony\Component\Mailer\SentMessage; +use Symfony\Component\Mailer\SmtpEnvelope; +use Symfony\Component\Mailer\Transport\Http\AbstractHttpTransport; +use Symfony\Component\Mime\Address; +use Symfony\Contracts\HttpClient\HttpClientInterface; + +/** + * @author Kevin Verschaeve + * + * @experimental in 4.3 + */ +class MandrillTransport extends AbstractHttpTransport +{ + private const ENDPOINT = 'https://mandrillapp.com/api/1.0/messages/send-raw.json'; + private $key; + + public function __construct(string $key, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null) + { + $this->key = $key; + + parent::__construct($client, $dispatcher, $logger); + } + + protected function doSend(SentMessage $message): void + { + $envelope = $message->getEnvelope(); + $response = $this->client->request('POST', self::ENDPOINT, [ + 'json' => [ + 'key' => $this->key, + 'to' => $this->getRecipients($envelope), + 'from_email' => $envelope->getSender()->getAddress(), + 'raw_message' => $message->toString(), + ], + ]); + + if (200 !== $response->getStatusCode()) { + $result = $response->toArray(false); + if ('error' === ($result['status'] ?? false)) { + throw new TransportException(sprintf('Unable to send an email: %s (code %s).', $result['message'], $result['code'])); + } + + throw new TransportException(sprintf('Unable to send an email (code %s).', $result['code'])); + } + } + + /** + * @return string[] + */ + private function getRecipients(SmtpEnvelope $envelope): array + { + return array_map(function (Address $recipient): string { + return $recipient->getAddress(); + }, $envelope->getRecipients()); + } +} diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php index 17f7a7fcf3364..09e728862c515 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php @@ -12,9 +12,11 @@ namespace Symfony\Component\Mailer\Bridge\Mailchimp\Transport; use Psr\Log\LoggerInterface; +use Symfony\Component\Mailer\Envelope; use Symfony\Component\Mailer\Exception\HttpTransportException; use Symfony\Component\Mailer\SentMessage; use Symfony\Component\Mailer\Transport\AbstractHttpTransport; +use Symfony\Component\Mime\Address; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; use Symfony\Contracts\HttpClient\ResponseInterface; @@ -45,7 +47,7 @@ protected function doSendHttp(SentMessage $message): ResponseInterface $response = $this->client->request('POST', 'https://'.$this->getEndpoint().'/api/1.0/messages/send-raw.json', [ 'json' => [ 'key' => $this->key, - 'to' => $this->stringifyAddresses($envelope->getRecipients()), + 'to' => $this->getRecipients($envelope->getRecipients()), 'from_email' => $envelope->getSender()->toString(), 'raw_message' => $message->toString(), ], @@ -69,4 +71,14 @@ private function getEndpoint(): ?string { return ($this->host ?: self::HOST).($this->port ? ':'.$this->port : ''); } + + /** + * @return string[] + */ + private function getRecipients(Envelope $envelope): array + { + return array_map(function (Address $recipient): string { + return $recipient->getAddress(); + }, $envelope->getRecipients()); + } } From e8ba15ed27d080ac3385292d3b57ce3621e987bf Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Fri, 31 Jan 2020 12:46:11 +0100 Subject: [PATCH 027/130] [Config][XmlReferenceDumper] Prevent potential \TypeError --- .../Component/Config/Definition/Dumper/XmlReferenceDumper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php index ff8c35388870d..da0a971213ee7 100644 --- a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php +++ b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php @@ -91,7 +91,7 @@ private function writeNode(NodeInterface $node, int $depth = 0, bool $root = fal } if ($prototype instanceof PrototypedArrayNode) { - $prototype->setName($key); + $prototype->setName($key ?? ''); $children = [$key => $prototype]; } elseif ($prototype instanceof ArrayNode) { $children = $prototype->getChildren(); From 00baa290e880a44d1c97e527024e175bc64dbe80 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 4 Feb 2020 08:15:38 +0100 Subject: [PATCH 028/130] [Translation] Add missing use statement --- src/Symfony/Component/Translation/Command/XliffLintCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Translation/Command/XliffLintCommand.php b/src/Symfony/Component/Translation/Command/XliffLintCommand.php index 770a15e209389..3f8fe7321836b 100644 --- a/src/Symfony/Component/Translation/Command/XliffLintCommand.php +++ b/src/Symfony/Component/Translation/Command/XliffLintCommand.php @@ -18,6 +18,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Component\Translation\Util\XliffUtils; /** From ce29631cd827634342ac5bd806c6809e6aed8d7e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 4 Feb 2020 08:15:38 +0100 Subject: [PATCH 029/130] [Translation] Add missing use statement --- src/Symfony/Component/Translation/Command/XliffLintCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Translation/Command/XliffLintCommand.php b/src/Symfony/Component/Translation/Command/XliffLintCommand.php index 922e026c483c8..6b1976dc6b42f 100644 --- a/src/Symfony/Component/Translation/Command/XliffLintCommand.php +++ b/src/Symfony/Component/Translation/Command/XliffLintCommand.php @@ -17,6 +17,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Translation\Exception\InvalidArgumentException; /** * Validates XLIFF files syntax and outputs encountered errors. From cd27b9d06f7e08716c5598cfddc2d50f5367fd4f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 4 Feb 2020 08:35:15 +0100 Subject: [PATCH 030/130] Add missing use statements --- src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php | 1 + src/Symfony/Component/Cache/Simple/TraceableCache.php | 1 + .../Session/Storage/Handler/SessionHandlerFactory.php | 2 +- .../Component/Mime/Test/Constraint/EmailAttachmentCount.php | 1 + .../Component/Mime/Test/Constraint/EmailHtmlBodyContains.php | 2 ++ .../Component/Mime/Test/Constraint/EmailTextBodyContains.php | 2 ++ src/Symfony/Component/Security/Core/User/LdapUserProvider.php | 4 ++-- src/Symfony/Component/Security/Http/Firewall.php | 1 + 8 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php b/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php index 7f9216497674e..ba002499022cf 100644 --- a/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php +++ b/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php @@ -12,6 +12,7 @@ namespace Symfony\Bundle\SecurityBundle\Debug; use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Http\Firewall\AbstractListener; use Symfony\Component\Security\Http\Firewall\ListenerInterface; /** diff --git a/src/Symfony/Component/Cache/Simple/TraceableCache.php b/src/Symfony/Component/Cache/Simple/TraceableCache.php index eac77badd4425..2214f1c818975 100644 --- a/src/Symfony/Component/Cache/Simple/TraceableCache.php +++ b/src/Symfony/Component/Cache/Simple/TraceableCache.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Cache\Simple; use Psr\SimpleCache\CacheInterface as Psr16CacheInterface; +use Symfony\Component\Cache\Adapter\TraceableAdapter; use Symfony\Component\Cache\PruneableInterface; use Symfony\Component\Cache\ResettableInterface; use Symfony\Contracts\Cache\CacheInterface; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/SessionHandlerFactory.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/SessionHandlerFactory.php index 1f017c8afdceb..b92bd0ffde3b3 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/SessionHandlerFactory.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/SessionHandlerFactory.php @@ -54,7 +54,7 @@ public static function createHandler($connection): AbstractSessionHandler case 0 === strpos($connection, 'rediss:'): case 0 === strpos($connection, 'memcached:'): if (!class_exists(AbstractAdapter::class)) { - throw new InvalidArgumentException(sprintf('Unsupported DSN "%s". Try running "composer require symfony/cache".', $connection)); + throw new \InvalidArgumentException(sprintf('Unsupported DSN "%s". Try running "composer require symfony/cache".', $connection)); } $handlerClass = 0 === strpos($connection, 'memcached:') ? MemcachedSessionHandler::class : RedisSessionHandler::class; $connection = AbstractAdapter::createConnection($connection, ['lazy' => true]); diff --git a/src/Symfony/Component/Mime/Test/Constraint/EmailAttachmentCount.php b/src/Symfony/Component/Mime/Test/Constraint/EmailAttachmentCount.php index b219f28b9d340..c0adbe3a0c0ce 100644 --- a/src/Symfony/Component/Mime/Test/Constraint/EmailAttachmentCount.php +++ b/src/Symfony/Component/Mime/Test/Constraint/EmailAttachmentCount.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Mime\Test\Constraint; use PHPUnit\Framework\Constraint\Constraint; +use Symfony\Component\Mime\Message; use Symfony\Component\Mime\RawMessage; final class EmailAttachmentCount extends Constraint diff --git a/src/Symfony/Component/Mime/Test/Constraint/EmailHtmlBodyContains.php b/src/Symfony/Component/Mime/Test/Constraint/EmailHtmlBodyContains.php index 8965195144a0b..3c61376e1acb1 100644 --- a/src/Symfony/Component/Mime/Test/Constraint/EmailHtmlBodyContains.php +++ b/src/Symfony/Component/Mime/Test/Constraint/EmailHtmlBodyContains.php @@ -12,6 +12,8 @@ namespace Symfony\Component\Mime\Test\Constraint; use PHPUnit\Framework\Constraint\Constraint; +use Symfony\Component\Mime\Message; +use Symfony\Component\Mime\RawMessage; final class EmailHtmlBodyContains extends Constraint { diff --git a/src/Symfony/Component/Mime/Test/Constraint/EmailTextBodyContains.php b/src/Symfony/Component/Mime/Test/Constraint/EmailTextBodyContains.php index b5e87f96f5f92..063d96306ba6b 100644 --- a/src/Symfony/Component/Mime/Test/Constraint/EmailTextBodyContains.php +++ b/src/Symfony/Component/Mime/Test/Constraint/EmailTextBodyContains.php @@ -12,6 +12,8 @@ namespace Symfony\Component\Mime\Test\Constraint; use PHPUnit\Framework\Constraint\Constraint; +use Symfony\Component\Mime\Message; +use Symfony\Component\Mime\RawMessage; final class EmailTextBodyContains extends Constraint { diff --git a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php index 406d141c47bb6..1770551fc9573 100644 --- a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php +++ b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php @@ -11,12 +11,12 @@ namespace Symfony\Component\Security\Core\User; -@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', LdapUserProvider::class, BaseLdapUserProvider::class), E_USER_DEPRECATED); - use Symfony\Component\Ldap\Entry; use Symfony\Component\Ldap\Security\LdapUserProvider as BaseLdapUserProvider; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; +@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', LdapUserProvider::class, BaseLdapUserProvider::class), E_USER_DEPRECATED); + /** * LdapUserProvider is a simple user provider on top of ldap. * diff --git a/src/Symfony/Component/Security/Http/Firewall.php b/src/Symfony/Component/Security/Http/Firewall.php index ee769496a6918..133c4486b9007 100644 --- a/src/Symfony/Component/Security/Http/Firewall.php +++ b/src/Symfony/Component/Security/Http/Firewall.php @@ -17,6 +17,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\Security\Http\Firewall\AbstractListener; use Symfony\Component\Security\Http\Firewall\AccessListener; use Symfony\Component\Security\Http\Firewall\LogoutListener; From a3e49f30c7fc5342cb27f7c378523059c2a2c2f4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 4 Feb 2020 09:03:00 +0100 Subject: [PATCH 031/130] Fix CS --- .../MergeDoctrineCollectionListener.php | 2 +- src/Symfony/Bridge/Twig/Command/DebugCommand.php | 4 ++-- src/Symfony/Bridge/Twig/Command/LintCommand.php | 4 ++-- .../FrameworkExtensionTest.php | 2 +- .../Tests/Functional/AbstractWebTestCase.php | 2 +- .../Tests/Functional/AbstractWebTestCase.php | 2 +- .../Cache/Tests/Adapter/ApcuAdapterTest.php | 4 ++-- .../Component/Console/Command/Command.php | 4 ++-- .../Component/CssSelector/Node/AbstractNode.php | 2 +- .../DependencyInjection/Compiler/Compiler.php | 2 +- .../DependencyInjection/Compiler/PassConfig.php | 2 +- .../DependencyInjection/ContainerBuilder.php | 2 +- .../DependencyInjection/Extension/Extension.php | 4 ++-- .../Loader/Configurator/AbstractConfigurator.php | 2 +- .../ContainerAwareEventDispatcher.php | 2 +- .../Component/ExpressionLanguage/Node/Node.php | 4 ++-- src/Symfony/Component/Form/AbstractType.php | 2 +- .../Form/Extension/Core/Type/ChoiceType.php | 2 +- .../HttpFoundation/RedirectResponse.php | 2 +- .../Storage/Handler/AbstractSessionHandler.php | 2 +- .../Session/Storage/NativeSessionStorage.php | 8 ++++---- .../Session/Storage/Proxy/AbstractProxy.php | 2 +- src/Symfony/Component/HttpKernel/Kernel.php | 6 +++--- src/Symfony/Component/HttpKernel/Log/Logger.php | 2 +- .../ContainerControllerResolverTest.php | 2 +- .../DataCollector/RequestDataCollectorTest.php | 2 +- .../HttpKernel/Tests/Log/LoggerTest.php | 2 +- src/Symfony/Component/Intl/Collator/Collator.php | 6 +++--- .../Intl/NumberFormatter/NumberFormatter.php | 10 +++++----- .../Component/Lock/Store/CombinedStore.php | 2 +- .../Component/Lock/Store/MemcachedStore.php | 2 +- src/Symfony/Component/Lock/Store/RedisStore.php | 2 +- .../Component/Lock/Store/SemaphoreStore.php | 2 +- .../PipeStdinInStdoutStdErrStreamSelect.php | 10 +++++----- .../Component/Routing/Annotation/Route.php | 2 +- .../Routing/Loader/ObjectRouteLoader.php | 2 +- .../Core/Authentication/Token/AbstractToken.php | 2 +- .../Core/Encoder/Argon2iPasswordEncoder.php | 8 ++++---- .../Guard/AbstractGuardAuthenticator.php | 2 +- .../AbstractFormLoginAuthenticator.php | 4 ++-- .../Security/Http/Logout/LogoutUrlGenerator.php | 2 +- .../Component/Serializer/Annotation/Groups.php | 4 ++-- .../Component/Serializer/Annotation/MaxDepth.php | 4 ++-- .../Serializer/Normalizer/AbstractNormalizer.php | 4 ++-- src/Symfony/Component/Serializer/Serializer.php | 8 ++++---- src/Symfony/Component/Validator/Constraint.php | 16 ++++++++-------- .../Validator/Constraints/AbstractComparison.php | 6 +++--- .../Validator/Constraints/Composite.php | 6 +++--- src/Symfony/Component/VarDumper/Cloner/Stub.php | 2 +- 49 files changed, 91 insertions(+), 91 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php b/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php index aafbd1d3af03f..27be3afc5592e 100644 --- a/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php +++ b/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php @@ -73,7 +73,7 @@ public function onSubmit(FormEvent $event) */ public function onBind(FormEvent $event) { - if (__CLASS__ === \get_class($this)) { + if (__CLASS__ === static::class) { $this->bc = false; } else { // parent::onBind() has been called diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index b45b580ee4b46..17c62aaf3c607 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -104,10 +104,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $decorated = $io->isDecorated(); // BC to be removed in 4.0 - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, 'getTwigEnvironment'); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', \get_class($this).'::getTwigEnvironment'), E_USER_DEPRECATED); + @trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), E_USER_DEPRECATED); $this->twig = $this->getTwigEnvironment(); } diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php index c8b5bb5ba2a05..dc47dd8cfb381 100644 --- a/src/Symfony/Bridge/Twig/Command/LintCommand.php +++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php @@ -105,10 +105,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new SymfonyStyle($input, $output); // BC to be removed in 4.0 - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, 'getTwigEnvironment'); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', \get_class($this).'::getTwigEnvironment'), E_USER_DEPRECATED); + @trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), E_USER_DEPRECATED); $this->twig = $this->getTwigEnvironment(); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 556fd9afd48e5..bdbb8ba4022b5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1141,7 +1141,7 @@ protected function createContainer(array $data = []) protected function createContainerFromFile($file, $data = [], $resetCompilerPasses = true, $compile = true) { - $cacheKey = md5(\get_class($this).$file.serialize($data)); + $cacheKey = md5(static::class.$file.serialize($data)); if ($compile && isset(self::$containerCache[$cacheKey])) { return self::$containerCache[$cacheKey]; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php index 03c6bdcbd7e11..eb0990ac81f6e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php @@ -68,6 +68,6 @@ protected static function createKernel(array $options = []) protected static function getVarDir() { - return 'FB'.substr(strrchr(\get_called_class(), '\\'), 1); + return 'FB'.substr(strrchr(static::class, '\\'), 1); } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php index 72a67a9a48763..280b3df71fa3a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php @@ -68,6 +68,6 @@ protected static function createKernel(array $options = []) protected static function getVarDir() { - return 'SB'.substr(strrchr(\get_called_class(), '\\'), 1); + return 'SB'.substr(strrchr(static::class, '\\'), 1); } } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php index 5cca73f56189d..2f35ef0c7cdfd 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php @@ -54,7 +54,7 @@ public function testUnserializable() public function testVersion() { - $namespace = str_replace('\\', '.', \get_class($this)); + $namespace = str_replace('\\', '.', static::class); $pool1 = new ApcuAdapter($namespace, 0, 'p1'); @@ -79,7 +79,7 @@ public function testVersion() public function testNamespace() { - $namespace = str_replace('\\', '.', \get_class($this)); + $namespace = str_replace('\\', '.', static::class); $pool1 = new ApcuAdapter($namespace.'_1', 0, 'p1'); diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 493800b315d92..0574cb7388062 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -55,7 +55,7 @@ class Command */ public static function getDefaultName() { - $class = \get_called_class(); + $class = static::class; $r = new \ReflectionProperty($class, 'defaultName'); return $class === $r->class ? static::$defaultName : null; @@ -348,7 +348,7 @@ public function setDefinition($definition) public function getDefinition() { if (null === $this->definition) { - throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($this))); + throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class)); } return $this->definition; diff --git a/src/Symfony/Component/CssSelector/Node/AbstractNode.php b/src/Symfony/Component/CssSelector/Node/AbstractNode.php index 1d5d8ff7ba1d8..de2e74aa88cab 100644 --- a/src/Symfony/Component/CssSelector/Node/AbstractNode.php +++ b/src/Symfony/Component/CssSelector/Node/AbstractNode.php @@ -34,7 +34,7 @@ abstract class AbstractNode implements NodeInterface public function getNodeName() { if (null === $this->nodeName) { - $this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', \get_called_class()); + $this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', static::class); } return $this->nodeName; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php index bf0d9c3eab058..c5f698b012b89 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php @@ -81,7 +81,7 @@ public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BE if (\func_num_args() >= 3) { $priority = func_get_arg(2); } else { - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php index bf8d75e6df280..e470cdec2dc98 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php @@ -123,7 +123,7 @@ public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_O if (\func_num_args() >= 3) { $priority = func_get_arg(2); } else { - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index f9bfcb52109d5..c8250a71cfb76 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -474,7 +474,7 @@ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig: if (\func_num_args() >= 3) { $priority = func_get_arg(2); } else { - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); diff --git a/src/Symfony/Component/DependencyInjection/Extension/Extension.php b/src/Symfony/Component/DependencyInjection/Extension/Extension.php index 8acb8ee31d48f..00fa9dc8da500 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/Extension.php +++ b/src/Symfony/Component/DependencyInjection/Extension/Extension.php @@ -65,7 +65,7 @@ public function getNamespace() */ public function getAlias() { - $className = \get_class($this); + $className = static::class; if ('Extension' != substr($className, -9)) { throw new BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.'); } @@ -79,7 +79,7 @@ public function getAlias() */ public function getConfiguration(array $config, ContainerBuilder $container) { - $class = \get_class($this); + $class = static::class; if (false !== strpos($class, "\0")) { return null; // ignore anonymous classes diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php index f7222d0ed50e8..5b3e704c25106 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php @@ -31,7 +31,7 @@ public function __call($method, $args) return \call_user_func_array([$this, 'set'.$method], $args); } - throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method)); + throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', static::class, $method)); } /** diff --git a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php index 1b33e1cab3f4e..18f1b4f8c317b 100644 --- a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php @@ -42,7 +42,7 @@ public function __construct(ContainerInterface $container) { $this->container = $container; - $class = \get_class($this); + $class = static::class; if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) { $class = get_parent_class($class); } diff --git a/src/Symfony/Component/ExpressionLanguage/Node/Node.php b/src/Symfony/Component/ExpressionLanguage/Node/Node.php index 7923cb1d64e4f..95045902be6e5 100644 --- a/src/Symfony/Component/ExpressionLanguage/Node/Node.php +++ b/src/Symfony/Component/ExpressionLanguage/Node/Node.php @@ -40,7 +40,7 @@ public function __toString() $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); } - $repr = [str_replace('Symfony\Component\ExpressionLanguage\Node\\', '', \get_class($this)).'('.implode(', ', $attributes)]; + $repr = [str_replace('Symfony\Component\ExpressionLanguage\Node\\', '', static::class).'('.implode(', ', $attributes)]; if (\count($this->nodes)) { foreach ($this->nodes as $node) { @@ -76,7 +76,7 @@ public function evaluate($functions, $values) public function toArray() { - throw new \BadMethodCallException(sprintf('Dumping a "%s" instance is not supported yet.', \get_class($this))); + throw new \BadMethodCallException(sprintf('Dumping a "%s" instance is not supported yet.', static::class)); } public function dump() diff --git a/src/Symfony/Component/Form/AbstractType.php b/src/Symfony/Component/Form/AbstractType.php index 1a9cfd75be7f6..be3c87d9ca612 100644 --- a/src/Symfony/Component/Form/AbstractType.php +++ b/src/Symfony/Component/Form/AbstractType.php @@ -52,7 +52,7 @@ public function configureOptions(OptionsResolver $resolver) */ public function getBlockPrefix() { - return StringUtil::fqcnToBlockPrefix(\get_class($this)) ?: ''; + return StringUtil::fqcnToBlockPrefix(static::class) ?: ''; } /** diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index aec61a2b4d80a..2bfc87dd80fe3 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -273,7 +273,7 @@ public function configureOptions(OptionsResolver $resolver) // Set by the user if (true !== $choicesAsValues) { - throw new \RuntimeException(sprintf('The "choices_as_values" option of the %s should not be used. Remove it and flip the contents of the "choices" option instead.', \get_class($this))); + throw new \RuntimeException(sprintf('The "choices_as_values" option of the %s should not be used. Remove it and flip the contents of the "choices" option instead.', static::class)); } @trigger_error('The "choices_as_values" option is deprecated since Symfony 3.1 and will be removed in 4.0. You should not use it anymore.', E_USER_DEPRECATED); diff --git a/src/Symfony/Component/HttpFoundation/RedirectResponse.php b/src/Symfony/Component/HttpFoundation/RedirectResponse.php index a19efba3e3d5e..71ba9f8251f5c 100644 --- a/src/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/src/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -42,7 +42,7 @@ public function __construct($url, $status = 302, $headers = []) throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); } - if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, \CASE_LOWER))) { + if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, CASE_LOWER))) { $this->headers->remove('cache-control'); } } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php index eb09c0b54e01f..84ba0ebba3f79 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -133,7 +133,7 @@ public function destroy($sessionId) } if (!headers_sent() && filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN)) { if (!$this->sessionName) { - throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', \get_class($this))); + throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', static::class)); } $sessionCookie = sprintf(' %s=', urlencode($this->sessionName)); $sessionCookieWithId = sprintf('%s%s;', $sessionCookie, urlencode($sessionId)); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index df7da3c72f046..cbf7cadc7e1f9 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -137,7 +137,7 @@ public function start() return true; } - if (\PHP_SESSION_ACTIVE === session_status()) { + if (PHP_SESSION_ACTIVE === session_status()) { throw new \RuntimeException('Failed to start the session: already started by PHP.'); } @@ -193,7 +193,7 @@ public function setName($name) public function regenerate($destroy = false, $lifetime = null) { // Cannot regenerate the session ID for non-active sessions. - if (\PHP_SESSION_ACTIVE !== session_status()) { + if (PHP_SESSION_ACTIVE !== session_status()) { return false; } @@ -341,7 +341,7 @@ public function isStarted() */ public function setOptions(array $options) { - if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) { + if (headers_sent() || PHP_SESSION_ACTIVE === session_status()) { return; } @@ -401,7 +401,7 @@ public function setSaveHandler($saveHandler = null) } $this->saveHandler = $saveHandler; - if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) { + if (headers_sent() || PHP_SESSION_ACTIVE === session_status()) { return; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index 0303729e7b387..cd0635a1684d7 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -65,7 +65,7 @@ public function isWrapper() */ public function isActive() { - return \PHP_SESSION_ACTIVE === session_status(); + return PHP_SESSION_ACTIVE === session_status(); } /** diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 87f102a0fb26d..82930d8c27d2b 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -236,7 +236,7 @@ public function getBundle($name, $first = true/*, $noDeprecation = false */) } if (!isset($this->bundleMap[$name])) { - throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, \get_class($this))); + throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, static::class)); } if (true === $first) { @@ -583,7 +583,7 @@ protected function initializeContainer() $oldContainer = null; if ($fresh = $cache->isFresh()) { // Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors - $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); + $errorLevel = error_reporting(E_ALL ^ E_WARNING); $fresh = $oldContainer = false; try { if (file_exists($cache->getPath()) && \is_object($this->container = include $cache->getPath())) { @@ -651,7 +651,7 @@ protected function initializeContainer() } if (null === $oldContainer && file_exists($cache->getPath())) { - $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); + $errorLevel = error_reporting(E_ALL ^ E_WARNING); try { $oldContainer = include $cache->getPath(); } catch (\Throwable $e) { diff --git a/src/Symfony/Component/HttpKernel/Log/Logger.php b/src/Symfony/Component/HttpKernel/Log/Logger.php index 50cbcd428f933..f490293a62e03 100644 --- a/src/Symfony/Component/HttpKernel/Log/Logger.php +++ b/src/Symfony/Component/HttpKernel/Log/Logger.php @@ -105,6 +105,6 @@ private function format($level, $message, array $context) $message = strtr($message, $replacements); } - return sprintf('%s [%s] %s', date(\DateTime::RFC3339), $level, $message).\PHP_EOL; + return sprintf('%s [%s] %s', date(\DateTime::RFC3339), $level, $message).PHP_EOL; } } diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php index bdb2a00f4be5a..97d21e95a44c8 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php @@ -39,7 +39,7 @@ public function testGetControllerService() $controller = $resolver->getController($request); - $this->assertInstanceOf(\get_class($this), $controller[0]); + $this->assertInstanceOf(static::class, $controller[0]); $this->assertSame('controllerMethod1', $controller[1]); } diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php index 9b6264be3920c..38979bba721d6 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php @@ -99,7 +99,7 @@ public function provideControllerCallables() '"Regular" callable', [$this, 'testControllerInspection'], [ - 'class' => RequestDataCollectorTest::class, + 'class' => self::class, 'method' => 'testControllerInspection', 'file' => __FILE__, 'line' => $r1->getStartLine(), diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php index 7439ae1376deb..79039c1c97555 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php @@ -186,7 +186,7 @@ public function testContextExceptionKeyCanBeExceptionOrOtherValues() public function testFormatter() { $this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile, function ($level, $message, $context) { - return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).\PHP_EOL; + return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).PHP_EOL; }); $this->logger->error('An error', ['foo' => 'bar']); diff --git a/src/Symfony/Component/Intl/Collator/Collator.php b/src/Symfony/Component/Intl/Collator/Collator.php index a9557ec482618..d72fa77144730 100644 --- a/src/Symfony/Component/Intl/Collator/Collator.php +++ b/src/Symfony/Component/Intl/Collator/Collator.php @@ -109,9 +109,9 @@ public static function create($locale) public function asort(&$array, $sortFlag = self::SORT_REGULAR) { $intlToPlainFlagMap = [ - self::SORT_REGULAR => \SORT_REGULAR, - self::SORT_NUMERIC => \SORT_NUMERIC, - self::SORT_STRING => \SORT_STRING, + self::SORT_REGULAR => SORT_REGULAR, + self::SORT_NUMERIC => SORT_NUMERIC, + self::SORT_STRING => SORT_STRING, ]; $plainSortFlag = isset($intlToPlainFlagMap[$sortFlag]) ? $intlToPlainFlagMap[$sortFlag] : self::SORT_REGULAR; diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php index e0426b364bd63..13bffbd45370d 100644 --- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php +++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php @@ -201,9 +201,9 @@ class NumberFormatter * @see https://php.net/round */ private static $phpRoundingMap = [ - self::ROUND_HALFDOWN => \PHP_ROUND_HALF_DOWN, - self::ROUND_HALFEVEN => \PHP_ROUND_HALF_EVEN, - self::ROUND_HALFUP => \PHP_ROUND_HALF_UP, + self::ROUND_HALFDOWN => PHP_ROUND_HALF_DOWN, + self::ROUND_HALFEVEN => PHP_ROUND_HALF_EVEN, + self::ROUND_HALFUP => PHP_ROUND_HALF_UP, ]; /** @@ -357,7 +357,7 @@ public function format($value, $type = self::TYPE_DEFAULT) // The original NumberFormatter does not support this format type if (self::TYPE_CURRENCY === $type) { - trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING); + trigger_error(__METHOD__.'(): Unsupported format type '.$type, E_USER_WARNING); return false; } @@ -513,7 +513,7 @@ public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0) $type = (int) $type; if (self::TYPE_DEFAULT === $type || self::TYPE_CURRENCY === $type) { - trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING); + trigger_error(__METHOD__.'(): Unsupported format type '.$type, E_USER_WARNING); return false; } diff --git a/src/Symfony/Component/Lock/Store/CombinedStore.php b/src/Symfony/Component/Lock/Store/CombinedStore.php index 241d39efcf096..d1ffaba653b89 100644 --- a/src/Symfony/Component/Lock/Store/CombinedStore.php +++ b/src/Symfony/Component/Lock/Store/CombinedStore.php @@ -93,7 +93,7 @@ public function save(Key $key) public function waitAndSave(Key $key) { - throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', static::class)); } /** diff --git a/src/Symfony/Component/Lock/Store/MemcachedStore.php b/src/Symfony/Component/Lock/Store/MemcachedStore.php index d61bc6fa069a5..7ff893d58f153 100644 --- a/src/Symfony/Component/Lock/Store/MemcachedStore.php +++ b/src/Symfony/Component/Lock/Store/MemcachedStore.php @@ -70,7 +70,7 @@ public function save(Key $key) public function waitAndSave(Key $key) { - throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', static::class)); } /** diff --git a/src/Symfony/Component/Lock/Store/RedisStore.php b/src/Symfony/Component/Lock/Store/RedisStore.php index 4e328340260a2..56a91d7f062fb 100644 --- a/src/Symfony/Component/Lock/Store/RedisStore.php +++ b/src/Symfony/Component/Lock/Store/RedisStore.php @@ -73,7 +73,7 @@ public function save(Key $key) public function waitAndSave(Key $key) { - throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', static::class)); } /** diff --git a/src/Symfony/Component/Lock/Store/SemaphoreStore.php b/src/Symfony/Component/Lock/Store/SemaphoreStore.php index 4ac15d6df11ba..fb72ff828d005 100644 --- a/src/Symfony/Component/Lock/Store/SemaphoreStore.php +++ b/src/Symfony/Component/Lock/Store/SemaphoreStore.php @@ -81,7 +81,7 @@ private function lock(Key $key, $blocking) if (\PHP_VERSION_ID >= 50601) { $acquired = @sem_acquire($resource, !$blocking); } elseif (!$blocking) { - throw new NotSupportedException(sprintf('The store "%s" does not supports non blocking locks.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not supports non blocking locks.', static::class)); } else { $acquired = @sem_acquire($resource); } diff --git a/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php b/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php index 9ea8981e19b7d..2e7716de7f4c7 100644 --- a/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php +++ b/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php @@ -29,15 +29,15 @@ $n = stream_select($r, $w, $e, 5); if (false === $n) { - die(ERR_SELECT_FAILED); + exit(ERR_SELECT_FAILED); } elseif ($n < 1) { - die(ERR_TIMEOUT); + exit(ERR_TIMEOUT); } if (in_array(STDOUT, $w) && strlen($out) > 0) { $written = fwrite(STDOUT, (string) $out, 32768); if (false === $written) { - die(ERR_WRITE_FAILED); + exit(ERR_WRITE_FAILED); } $out = (string) substr($out, $written); } @@ -48,7 +48,7 @@ if (in_array(STDERR, $w) && strlen($err) > 0) { $written = fwrite(STDERR, (string) $err, 32768); if (false === $written) { - die(ERR_WRITE_FAILED); + exit(ERR_WRITE_FAILED); } $err = (string) substr($err, $written); } @@ -65,7 +65,7 @@ if (false === $str || feof(STDIN)) { $read = null; if (!feof(STDIN)) { - die(ERR_READ_FAILED); + exit(ERR_READ_FAILED); } } } diff --git a/src/Symfony/Component/Routing/Annotation/Route.php b/src/Symfony/Component/Routing/Annotation/Route.php index 338ba512dfe47..42edbbcb22fe9 100644 --- a/src/Symfony/Component/Routing/Annotation/Route.php +++ b/src/Symfony/Component/Routing/Annotation/Route.php @@ -46,7 +46,7 @@ public function __construct(array $data) foreach ($data as $key => $value) { $method = 'set'.str_replace('_', '', $key); if (!method_exists($this, $method)) { - throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, \get_class($this))); + throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, static::class)); } $this->$method($value); } diff --git a/src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php b/src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php index ce58dc7da44e2..b5fa1ccede546 100644 --- a/src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php +++ b/src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php @@ -55,7 +55,7 @@ public function load($resource, $type = null) $loaderObject = $this->getServiceObject($serviceString); if (!\is_object($loaderObject)) { - throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject))); + throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', static::class, \gettype($loaderObject))); } if (!method_exists($loaderObject, $method)) { diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php index 83f85abda2a12..9d5a01d942ad4 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php @@ -216,7 +216,7 @@ public function setAttribute($name, $value) */ public function __toString() { - $class = \get_class($this); + $class = static::class; $class = substr($class, strrpos($class, '\\') + 1); $roles = []; diff --git a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php index 99738365ad4cf..e812cd25b1dcb 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php @@ -26,7 +26,7 @@ public static function isSupported() return true; } - return version_compare(\extension_loaded('sodium') ? \SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>='); + return version_compare(\extension_loaded('sodium') ? SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>='); } /** @@ -79,15 +79,15 @@ public function isPasswordValid($encoded, $raw, $salt) private function encodePasswordNative($raw) { - return password_hash($raw, \PASSWORD_ARGON2I); + return password_hash($raw, PASSWORD_ARGON2I); } private function encodePasswordSodiumFunction($raw) { $hash = sodium_crypto_pwhash_str( $raw, - \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, - \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE + SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, + SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE ); sodium_memzero($raw); diff --git a/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php b/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php index 7bcfc39438dd9..f905b2f6b39b4 100644 --- a/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php @@ -27,7 +27,7 @@ abstract class AbstractGuardAuthenticator implements AuthenticatorInterface */ public function supports(Request $request) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Implement the "%s::supports()" method in class "%s" instead.', __METHOD__, AuthenticatorInterface::class, \get_class($this)), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Implement the "%s::supports()" method in class "%s" instead.', __METHOD__, AuthenticatorInterface::class, static::class), E_USER_DEPRECATED); return true; } diff --git a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php index a9c565b6bb9b2..2c633b30a05e1 100644 --- a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php @@ -61,10 +61,10 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio */ public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) { - @trigger_error(sprintf('The AbstractFormLoginAuthenticator::onAuthenticationSuccess() implementation was deprecated in Symfony 3.1 and will be removed in Symfony 4.0. You should implement this method yourself in %s and remove getDefaultSuccessRedirectUrl().', \get_class($this)), E_USER_DEPRECATED); + @trigger_error(sprintf('The AbstractFormLoginAuthenticator::onAuthenticationSuccess() implementation was deprecated in Symfony 3.1 and will be removed in Symfony 4.0. You should implement this method yourself in %s and remove getDefaultSuccessRedirectUrl().', static::class), E_USER_DEPRECATED); if (!method_exists($this, 'getDefaultSuccessRedirectUrl')) { - throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectUrl() in %s.', \get_class($this))); + throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectUrl() in %s.', static::class)); } $targetPath = null; diff --git a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php index 71a071f3508a6..b00d34f90f9d5 100644 --- a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php +++ b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php @@ -52,7 +52,7 @@ public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter if (\func_num_args() >= 6) { $context = func_get_arg(5); } else { - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('The "%s()" method will have a 6th `string $context = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); diff --git a/src/Symfony/Component/Serializer/Annotation/Groups.php b/src/Symfony/Component/Serializer/Annotation/Groups.php index 7a9b0bd2c1052..4358a3e26dcb9 100644 --- a/src/Symfony/Component/Serializer/Annotation/Groups.php +++ b/src/Symfony/Component/Serializer/Annotation/Groups.php @@ -34,13 +34,13 @@ class Groups public function __construct(array $data) { if (!isset($data['value']) || !$data['value']) { - throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', \get_class($this))); + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', static::class)); } $value = (array) $data['value']; foreach ($value as $group) { if (!\is_string($group)) { - throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of strings.', \get_class($this))); + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of strings.', static::class)); } } diff --git a/src/Symfony/Component/Serializer/Annotation/MaxDepth.php b/src/Symfony/Component/Serializer/Annotation/MaxDepth.php index a274c20d85283..9939fdab1cd18 100644 --- a/src/Symfony/Component/Serializer/Annotation/MaxDepth.php +++ b/src/Symfony/Component/Serializer/Annotation/MaxDepth.php @@ -31,11 +31,11 @@ class MaxDepth public function __construct(array $data) { if (!isset($data['value'])) { - throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', \get_class($this))); + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', static::class)); } if (!\is_int($data['value']) || $data['value'] <= 0) { - throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a positive integer.', \get_class($this))); + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a positive integer.', static::class)); } $this->maxDepth = $data['value']; diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index bf9afb701e45b..b2b4604e35a39 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -304,10 +304,10 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref if (\func_num_args() >= 6) { $format = func_get_arg(5); } else { - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s::%s() will have a 6th `string $format = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s::%s() will have a 6th `string $format = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', static::class, __FUNCTION__), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index a29a1482ddef8..0e2143e93a555 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -193,7 +193,7 @@ public function supportsNormalization($data, $format = null/*, array $context = if (\func_num_args() > 2) { $context = func_get_arg(2); } else { - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('The "%s()" method will have a third `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); @@ -214,7 +214,7 @@ public function supportsDenormalization($data, $type, $format = null/*, array $c if (\func_num_args() > 3) { $context = func_get_arg(3); } else { - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('The "%s()" method will have a fourth `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); @@ -292,7 +292,7 @@ public function supportsEncoding($format/*, array $context = []*/) if (\func_num_args() > 1) { $context = func_get_arg(1); } else { - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); @@ -313,7 +313,7 @@ public function supportsDecoding($format/*, array $context = []*/) if (\func_num_args() > 1) { $context = func_get_arg(1); } else { - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); diff --git a/src/Symfony/Component/Validator/Constraint.php b/src/Symfony/Component/Validator/Constraint.php index 349698eb1af59..693689b912c34 100644 --- a/src/Symfony/Component/Validator/Constraint.php +++ b/src/Symfony/Component/Validator/Constraint.php @@ -70,7 +70,7 @@ abstract class Constraint public static function getErrorName($errorCode) { if (!isset(static::$errorNames[$errorCode])) { - throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, \get_called_class())); + throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class)); } return static::$errorNames[$errorCode]; @@ -115,7 +115,7 @@ public function __construct($options = null) if (\is_array($options) && isset($options['value']) && !property_exists($this, 'value')) { if (null === $defaultOption) { - throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', \get_class($this))); + throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class)); } $options[$defaultOption] = $options['value']; @@ -136,7 +136,7 @@ public function __construct($options = null) } } elseif (null !== $options && !(\is_array($options) && 0 === \count($options))) { if (null === $defaultOption) { - throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', \get_class($this))); + throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class)); } if (\array_key_exists($defaultOption, $knownOptions)) { @@ -148,11 +148,11 @@ public function __construct($options = null) } if (\count($invalidOptions) > 0) { - throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), \get_class($this)), $invalidOptions); + throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), static::class), $invalidOptions); } if (\count($missingOptions) > 0) { - throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), \get_class($this)), array_keys($missingOptions)); + throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), static::class), array_keys($missingOptions)); } } @@ -176,7 +176,7 @@ public function __set($option, $value) return; } - throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, \get_class($this)), [$option]); + throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]); } /** @@ -202,7 +202,7 @@ public function __get($option) return $this->groups; } - throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, \get_class($this)), [$option]); + throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]); } /** @@ -266,7 +266,7 @@ public function getRequiredOptions() */ public function validatedBy() { - return \get_class($this).'Validator'; + return static::class.'Validator'; } /** diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparison.php b/src/Symfony/Component/Validator/Constraints/AbstractComparison.php index 89c2690c081cd..01c8be31cbf06 100644 --- a/src/Symfony/Component/Validator/Constraints/AbstractComparison.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparison.php @@ -38,15 +38,15 @@ public function __construct($options = null) if (\is_array($options)) { if (!isset($options['value']) && !isset($options['propertyPath'])) { - throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', \get_class($this))); + throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', static::class)); } if (isset($options['value']) && isset($options['propertyPath'])) { - throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', \get_class($this))); + throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', static::class)); } if (isset($options['propertyPath']) && !class_exists(PropertyAccess::class)) { - throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option.', \get_class($this))); + throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option.', static::class)); } } diff --git a/src/Symfony/Component/Validator/Constraints/Composite.php b/src/Symfony/Component/Validator/Constraints/Composite.php index 18ea5e319f7f1..9c423b0dc376a 100644 --- a/src/Symfony/Component/Validator/Constraints/Composite.php +++ b/src/Symfony/Component/Validator/Constraints/Composite.php @@ -71,11 +71,11 @@ public function __construct($options = null) $constraint = \get_class($constraint); } - throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, \get_class($this))); + throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, static::class)); } if ($constraint instanceof Valid) { - throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', \get_class($this))); + throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', static::class)); } } @@ -99,7 +99,7 @@ public function __construct($options = null) $excessGroups = array_diff($constraint->groups, $this->groups); if (\count($excessGroups) > 0) { - throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), \get_class($this))); + throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), static::class)); } } else { $constraint->groups = $this->groups; diff --git a/src/Symfony/Component/VarDumper/Cloner/Stub.php b/src/Symfony/Component/VarDumper/Cloner/Stub.php index 27dd3ef32c4df..a56120ce36311 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Stub.php +++ b/src/Symfony/Component/VarDumper/Cloner/Stub.php @@ -48,7 +48,7 @@ public function __sleep() { $properties = []; - if (!isset(self::$defaultProperties[$c = \get_class($this)])) { + if (!isset(self::$defaultProperties[$c = static::class])) { self::$defaultProperties[$c] = get_class_vars($c); foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) { From de8348a033b9d43f475069637f220c043c51c2d5 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 4 Feb 2020 10:29:10 +0100 Subject: [PATCH 032/130] Fix CS --- src/Symfony/Bridge/Monolog/Logger.php | 4 +- .../Monolog/Processor/DebugProcessor.php | 4 +- .../Bridge/PhpUnit/Tests/DnsMockTest.php | 98 +++++++++---------- .../Bridge/PhpUnit/bin/simple-phpunit.php | 47 +++++---- .../CacheWarmer/RouterCacheWarmer.php | 2 +- .../Controller/AbstractController.php | 2 +- .../ResolveControllerNameSubscriber.php | 2 +- .../CompleteConfigurationTest.php | 4 +- src/Symfony/Component/BrowserKit/Client.php | 14 +-- .../Cache/Adapter/RedisTagAwareAdapter.php | 2 +- .../Component/Cache/Traits/ContractsTrait.php | 2 +- .../Component/Cache/Traits/PdoTrait.php | 2 +- .../Component/Config/Definition/BaseNode.php | 2 +- .../Definition/Builder/NodeDefinition.php | 2 +- .../Component/Config/Loader/FileLoader.php | 2 +- src/Symfony/Component/Console/Application.php | 4 +- .../Component/Console/Command/Command.php | 2 +- .../Console/Tests/ApplicationTest.php | 12 +-- .../Compiler/AbstractRecursivePass.php | 2 +- .../DependencyInjection/Loader/FileLoader.php | 2 +- src/Symfony/Component/DomCrawler/Crawler.php | 2 +- .../EventDispatcher/EventDispatcher.php | 2 +- src/Symfony/Component/Finder/Finder.php | 2 +- .../Component/Form/AbstractTypeExtension.php | 2 +- .../Form/Tests/AbstractLayoutTest.php | 2 +- .../Component/HttpClient/HttpClientTrait.php | 2 +- .../HttpClient/Response/CurlResponse.php | 4 +- .../HttpClient/Response/ResponseTrait.php | 2 +- .../Storage/PhpBridgeSessionStorageTest.php | 4 +- src/Symfony/Component/HttpKernel/Kernel.php | 6 +- .../Data/Generator/LocaleDataGenerator.php | 2 +- .../Component/Lock/Store/CombinedStore.php | 2 +- .../Component/Lock/Store/MemcachedStore.php | 2 +- src/Symfony/Component/Lock/Store/PdoStore.php | 2 +- .../Component/Lock/Store/RedisStore.php | 2 +- .../Component/Messenger/HandleTrait.php | 6 +- .../Mime/Encoder/Base64ContentEncoder.php | 2 +- .../Component/Mime/Encoder/QpEncoder.php | 2 +- .../Component/Routing/Annotation/Route.php | 2 +- .../Component/Routing/Loader/ObjectLoader.php | 2 +- .../Core/Encoder/Argon2iPasswordEncoder.php | 6 +- .../Core/Encoder/NativePasswordEncoder.php | 6 +- .../Core/Encoder/SodiumPasswordEncoder.php | 6 +- .../Core/Tests/Encoder/EncoderFactoryTest.php | 2 +- .../Tests/Firewall/ContextListenerTest.php | 10 +- .../Annotation/DiscriminatorMap.php | 4 +- .../Serializer/Annotation/SerializedName.php | 4 +- .../Normalizer/AbstractNormalizer.php | 4 +- .../Normalizer/AbstractObjectNormalizer.php | 2 +- .../ConstraintViolationListNormalizer.php | 2 +- .../Normalizer/CustomNormalizer.php | 2 +- .../Normalizer/DataUriNormalizer.php | 2 +- .../Normalizer/DateIntervalNormalizer.php | 2 +- .../Normalizer/DateTimeNormalizer.php | 2 +- .../Normalizer/DateTimeZoneNormalizer.php | 2 +- .../Normalizer/GetSetMethodNormalizer.php | 2 +- .../Normalizer/JsonSerializableNormalizer.php | 2 +- .../Normalizer/ObjectNormalizer.php | 2 +- .../Normalizer/PropertyNormalizer.php | 2 +- .../Translation/Extractor/PhpExtractor.php | 2 +- .../Translation/IdentityTranslator.php | 2 +- .../Constraints/AbstractComparison.php | 2 +- .../Constraints/NumberConstraintTrait.php | 4 +- .../Component/Validator/Constraints/Range.php | 6 +- .../VarDumper/Resources/functions/dump.php | 2 +- src/Symfony/Contracts/Cache/CacheTrait.php | 3 +- 66 files changed, 177 insertions(+), 171 deletions(-) diff --git a/src/Symfony/Bridge/Monolog/Logger.php b/src/Symfony/Bridge/Monolog/Logger.php index e5d5987dd9328..a4c25392ab9cc 100644 --- a/src/Symfony/Bridge/Monolog/Logger.php +++ b/src/Symfony/Bridge/Monolog/Logger.php @@ -29,7 +29,7 @@ class Logger extends BaseLogger implements DebugLoggerInterface, ResetInterface */ public function getLogs(/* Request $request = null */) { - 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) { + if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @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); } @@ -47,7 +47,7 @@ public function getLogs(/* Request $request = null */) */ public function countErrors(/* Request $request = null */) { - 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) { + if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @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); } diff --git a/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php b/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php index 432c0b5ae8d5e..6addf02638dc8 100644 --- a/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php +++ b/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php @@ -63,7 +63,7 @@ public function __invoke(array $record) */ public function getLogs(/* Request $request = null */) { - 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) { + if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @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); } @@ -85,7 +85,7 @@ public function getLogs(/* Request $request = null */) */ public function countErrors(/* Request $request = null */) { - 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) { + if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @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); } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php index 66c7684897d8b..635c43c4af06e 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php @@ -18,15 +18,15 @@ class DnsMockTest extends TestCase { protected function tearDown(): void { - DnsMock::withMockedHosts(array()); + DnsMock::withMockedHosts([]); } public function testCheckdnsrr() { - DnsMock::withMockedHosts(array('example.com' => array(array('type' => 'MX')))); + DnsMock::withMockedHosts(['example.com' => [['type' => 'MX']]]); $this->assertTrue(DnsMock::checkdnsrr('example.com')); - DnsMock::withMockedHosts(array('example.com' => array(array('type' => 'A')))); + DnsMock::withMockedHosts(['example.com' => [['type' => 'A']]]); $this->assertFalse(DnsMock::checkdnsrr('example.com')); $this->assertTrue(DnsMock::checkdnsrr('example.com', 'a')); $this->assertTrue(DnsMock::checkdnsrr('example.com', 'any')); @@ -35,34 +35,34 @@ public function testCheckdnsrr() public function testGetmxrr() { - DnsMock::withMockedHosts(array( - 'example.com' => array(array( + DnsMock::withMockedHosts([ + 'example.com' => [[ 'type' => 'MX', 'host' => 'mx.example.com', 'pri' => 10, - )), - )); + ]], + ]); $this->assertFalse(DnsMock::getmxrr('foobar.com', $mxhosts, $weight)); $this->assertTrue(DnsMock::getmxrr('example.com', $mxhosts, $weight)); - $this->assertSame(array('mx.example.com'), $mxhosts); - $this->assertSame(array(10), $weight); + $this->assertSame(['mx.example.com'], $mxhosts); + $this->assertSame([10], $weight); } public function testGethostbyaddr() { - DnsMock::withMockedHosts(array( - 'example.com' => array( - array( + DnsMock::withMockedHosts([ + 'example.com' => [ + [ 'type' => 'A', 'ip' => '1.2.3.4', - ), - array( + ], + [ 'type' => 'AAAA', 'ipv6' => '::12', - ), - ), - )); + ], + ], + ]); $this->assertSame('::21', DnsMock::gethostbyaddr('::21')); $this->assertSame('example.com', DnsMock::gethostbyaddr('::12')); @@ -71,18 +71,18 @@ public function testGethostbyaddr() public function testGethostbyname() { - DnsMock::withMockedHosts(array( - 'example.com' => array( - array( + DnsMock::withMockedHosts([ + 'example.com' => [ + [ 'type' => 'AAAA', 'ipv6' => '::12', - ), - array( + ], + [ 'type' => 'A', 'ip' => '1.2.3.4', - ), - ), - )); + ], + ], + ]); $this->assertSame('foobar.com', DnsMock::gethostbyname('foobar.com')); $this->assertSame('1.2.3.4', DnsMock::gethostbyname('example.com')); @@ -90,59 +90,59 @@ public function testGethostbyname() public function testGethostbynamel() { - DnsMock::withMockedHosts(array( - 'example.com' => array( - array( + DnsMock::withMockedHosts([ + 'example.com' => [ + [ 'type' => 'A', 'ip' => '1.2.3.4', - ), - array( + ], + [ 'type' => 'A', 'ip' => '2.3.4.5', - ), - ), - )); + ], + ], + ]); $this->assertFalse(DnsMock::gethostbynamel('foobar.com')); - $this->assertSame(array('1.2.3.4', '2.3.4.5'), DnsMock::gethostbynamel('example.com')); + $this->assertSame(['1.2.3.4', '2.3.4.5'], DnsMock::gethostbynamel('example.com')); } public function testDnsGetRecord() { - DnsMock::withMockedHosts(array( - 'example.com' => array( - array( + DnsMock::withMockedHosts([ + 'example.com' => [ + [ 'type' => 'A', 'ip' => '1.2.3.4', - ), - array( + ], + [ 'type' => 'PTR', 'ip' => '2.3.4.5', - ), - ), - )); + ], + ], + ]); - $records = array( - array( + $records = [ + [ 'host' => 'example.com', 'class' => 'IN', 'ttl' => 1, 'type' => 'A', 'ip' => '1.2.3.4', - ), - $ptr = array( + ], + $ptr = [ 'host' => 'example.com', 'class' => 'IN', 'ttl' => 1, 'type' => 'PTR', 'ip' => '2.3.4.5', - ), - ); + ], + ]; $this->assertFalse(DnsMock::dns_get_record('foobar.com')); $this->assertSame($records, DnsMock::dns_get_record('example.com')); $this->assertSame($records, DnsMock::dns_get_record('example.com', DNS_ALL)); $this->assertSame($records, DnsMock::dns_get_record('example.com', DNS_A | DNS_PTR)); - $this->assertSame(array($ptr), DnsMock::dns_get_record('example.com', DNS_PTR)); + $this->assertSame([$ptr], DnsMock::dns_get_record('example.com', DNS_PTR)); } } diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php index 6bb2c292e7777..401aafde162a4 100644 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php @@ -15,7 +15,7 @@ error_reporting(-1); global $argv, $argc; -$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array(); +$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : []; $argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0; $getEnvVar = function ($name, $default = false) use ($argv) { if (false !== $value = getenv($name)) { @@ -130,11 +130,11 @@ $PHP .= ' -qrr'; } -$defaultEnvs = array( +$defaultEnvs = [ 'COMPOSER' => 'composer.json', 'COMPOSER_VENDOR_DIR' => 'vendor', 'COMPOSER_BIN_DIR' => 'bin', -); +]; foreach ($defaultEnvs as $envName => $envValue) { if ($envValue !== getenv($envName)) { @@ -147,21 +147,21 @@ || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`)) || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer`) : `which composer 2> /dev/null`)) || file_exists($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`).DIRECTORY_SEPARATOR.'composer.phar') - ? (file_get_contents($COMPOSER, false, null, 0, 18) === '#!/usr/bin/env php' ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang + ? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang : 'composer'; -$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml': '')); -$configurationHash = md5(implode(PHP_EOL, array(md5_file(__FILE__), $SYMFONY_PHPUNIT_REMOVE, (int) $PHPUNIT_REMOVE_RETURN_TYPEHINT))); -$PHPUNIT_VERSION_DIR=sprintf('phpunit-%s-%d', $PHPUNIT_VERSION, $PHPUNIT_REMOVE_RETURN_TYPEHINT); +$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml' : '')); +$configurationHash = md5(implode(PHP_EOL, [md5_file(__FILE__), $SYMFONY_PHPUNIT_REMOVE, (int) $PHPUNIT_REMOVE_RETURN_TYPEHINT])); +$PHPUNIT_VERSION_DIR = sprintf('phpunit-%s-%d', $PHPUNIT_VERSION, $PHPUNIT_REMOVE_RETURN_TYPEHINT); if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationHash !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION_DIR.md5")) { // Build a standalone phpunit without symfony/yaml nor prophecy by default @mkdir($PHPUNIT_DIR, 0777, true); chdir($PHPUNIT_DIR); if (file_exists("$PHPUNIT_VERSION_DIR")) { - passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL': 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); + passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL' : 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); rename("$PHPUNIT_VERSION_DIR", "$PHPUNIT_VERSION_DIR.old"); - passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s': 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); + passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s' : 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); } $passthruOrFail("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\""); @copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd'); @@ -187,7 +187,7 @@ putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99"); $q = '\\' === DIRECTORY_SEPARATOR ? '"' : ''; // --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS - $exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress --ansi$q", array(), $p, getcwd())); + $exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress --ansi$q", [], $p, getcwd())); putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : '')); if ($exit) { exit($exit); @@ -233,13 +233,20 @@ class SymfonyBlacklistPhpunit {} } if ($PHPUNIT_VERSION < 8.0) { - $argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; return false; }); + $argv = array_filter($argv, function ($v) use (&$argc) { + if ('--do-not-cache-result' !== $v) { + return true; + } + --$argc; + + return false; + }); } elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) { $argv[] = '--do-not-cache-result'; ++$argc; } -$components = array(); +$components = []; $cmd = array_map('escapeshellarg', $argv); $exit = 0; @@ -274,7 +281,7 @@ class SymfonyBlacklistPhpunit {} if ($components) { $skippedTests = isset($_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS']) ? $_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS'] : false; - $runningProcs = array(); + $runningProcs = []; foreach ($components as $component) { // Run phpunit tests in parallel @@ -285,7 +292,7 @@ class SymfonyBlacklistPhpunit {} $c = escapeshellarg($component); - if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), array(), $pipes)) { + if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), [], $pipes)) { $runningProcs[$component] = $proc; } else { $exit = 1; @@ -295,7 +302,7 @@ class SymfonyBlacklistPhpunit {} while ($runningProcs) { usleep(300000); - $terminatedProcs = array(); + $terminatedProcs = []; foreach ($runningProcs as $component => $proc) { $procStatus = proc_get_status($proc); if (!$procStatus['running']) { @@ -306,7 +313,7 @@ class SymfonyBlacklistPhpunit {} } foreach ($terminatedProcs as $component => $procStatus) { - foreach (array('out', 'err') as $file) { + foreach (['out', 'err'] as $file) { $file = "$component/phpunit.std$file"; readfile($file); unlink($file); @@ -316,7 +323,7 @@ class SymfonyBlacklistPhpunit {} // STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409) // STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005) // STATUS_HEAP_CORRUPTION (-1073740940/0xC0000374) - if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, array(-1073740791, -1073741819, -1073740940)))) { + if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, [-1073740791, -1073741819, -1073740940]))) { $exit = $procStatus; echo "\033[41mKO\033[0m $component\n\n"; } else { @@ -326,9 +333,11 @@ class SymfonyBlacklistPhpunit {} } } elseif (!isset($argv[1]) || 'install' !== $argv[1] || file_exists('install')) { if (!class_exists('SymfonyBlacklistSimplePhpunit', false)) { - class SymfonyBlacklistSimplePhpunit {} + class SymfonyBlacklistSimplePhpunit + { + } } - array_splice($argv, 1, 0, array('--colors=always')); + array_splice($argv, 1, 0, ['--colors=always']); $_SERVER['argv'] = $argv; $_SERVER['argc'] = ++$argc; include "$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit"; diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php index 61d9f21a5aaf5..a16c06e4e0660 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php @@ -49,7 +49,7 @@ public function warmUp($cacheDir) return; } - @trigger_error(sprintf('Passing a %s without implementing %s is deprecated since Symfony 4.1.', RouterInterface::class, WarmableInterface::class), \E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a %s without implementing %s is deprecated since Symfony 4.1.', RouterInterface::class, WarmableInterface::class), E_USER_DEPRECATED); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php index 787ccfa386c18..eb70bf2d0e822 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php @@ -65,7 +65,7 @@ public function setContainer(ContainerInterface $container): ?ContainerInterface protected function getParameter(string $name) { if (!$this->container->has('parameter_bag')) { - throw new ServiceNotFoundException('parameter_bag', null, null, [], sprintf('The "%s::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a service subscriber? This can be fixed either by using autoconfiguration or by manually wiring a "parameter_bag" in the service locator passed to the controller.', \get_class($this))); + throw new ServiceNotFoundException('parameter_bag', null, null, [], sprintf('The "%s::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a service subscriber? This can be fixed either by using autoconfiguration or by manually wiring a "parameter_bag" in the service locator passed to the controller.', static::class)); } return $this->container->get('parameter_bag')->get($name); diff --git a/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php b/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php index 169c03277970f..e6f6bfd76592e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php +++ b/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php @@ -49,7 +49,7 @@ public function resolveControllerName(...$args) public function __call(string $method, array $args) { if ('onKernelRequest' !== $method && 'onKernelRequest' !== strtolower($method)) { - throw new \Error(sprintf('Error: Call to undefined method %s::%s()', \get_class($this), $method)); + throw new \Error(sprintf('Error: Call to undefined method %s::%s()', static::class, $method)); } $event = $args[0]; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index 8b1ce20bd57a7..e358cb9945809 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -432,7 +432,7 @@ public function testEncodersWithArgon2i() ], 'JMS\FooBundle\Entity\User7' => [ 'class' => $sodium ? SodiumPasswordEncoder::class : NativePasswordEncoder::class, - 'arguments' => $sodium ? [256, 1] : [1, 262144, null, \PASSWORD_ARGON2I], + 'arguments' => $sodium ? [256, 1] : [1, 262144, null, PASSWORD_ARGON2I], ], ]], $container->getDefinition('security.encoder_factory.generic')->getArguments()); } @@ -547,7 +547,7 @@ public function testEncodersWithBCrypt() ], 'JMS\FooBundle\Entity\User7' => [ 'class' => NativePasswordEncoder::class, - 'arguments' => [null, null, 15, \PASSWORD_BCRYPT], + 'arguments' => [null, null, 15, PASSWORD_BCRYPT], ], ]], $container->getDefinition('security.encoder_factory.generic')->getArguments()); } diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 3135fbcedde40..8db4e68ec71cb 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -199,7 +199,7 @@ public function getCookieJar() public function getCrawler() { if (null === $this->crawler) { - @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', static::class.'::'.__FUNCTION__), E_USER_DEPRECATED); // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); } @@ -214,7 +214,7 @@ public function getCrawler() public function getInternalResponse() { if (null === $this->internalResponse) { - @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', static::class.'::'.__FUNCTION__), E_USER_DEPRECATED); // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); } @@ -234,7 +234,7 @@ public function getInternalResponse() public function getResponse() { if (null === $this->response) { - @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', static::class.'::'.__FUNCTION__), E_USER_DEPRECATED); // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); } @@ -249,7 +249,7 @@ public function getResponse() public function getInternalRequest() { if (null === $this->internalRequest) { - @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', static::class.'::'.__FUNCTION__), E_USER_DEPRECATED); // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); } @@ -269,7 +269,7 @@ public function getInternalRequest() public function getRequest() { if (null === $this->request) { - @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', static::class.'::'.__FUNCTION__), E_USER_DEPRECATED); // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); } @@ -314,8 +314,8 @@ public function clickLink(string $linkText): Crawler */ public function submit(Form $form, array $values = []/*, array $serverParameters = []*/) { - if (\func_num_args() < 3 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { - @trigger_error(sprintf('The "%s()" method will have a new "array $serverParameters = []" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED); + if (\func_num_args() < 3 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + @trigger_error(sprintf('The "%s()" method will have a new "array $serverParameters = []" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', static::class.'::'.__FUNCTION__), E_USER_DEPRECATED); } $form->setValues($values); diff --git a/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php index 1dbce4b0db7d4..f936afd589e31 100644 --- a/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php @@ -80,7 +80,7 @@ public function __construct($redisClient, string $namespace = '', int $defaultLi foreach (\is_array($compression) ? $compression : [$compression] as $c) { if (\Redis::COMPRESSION_NONE !== $c) { - throw new InvalidArgumentException(sprintf('phpredis compression must be disabled when using "%s", use "%s" instead.', \get_class($this), DeflateMarshaller::class)); + throw new InvalidArgumentException(sprintf('phpredis compression must be disabled when using "%s", use "%s" instead.', static::class, DeflateMarshaller::class)); } } } diff --git a/src/Symfony/Component/Cache/Traits/ContractsTrait.php b/src/Symfony/Component/Cache/Traits/ContractsTrait.php index c5827c3b73bc9..06070c970cac5 100644 --- a/src/Symfony/Component/Cache/Traits/ContractsTrait.php +++ b/src/Symfony/Component/Cache/Traits/ContractsTrait.php @@ -52,7 +52,7 @@ public function setCallbackWrapper(?callable $callbackWrapper): callable private function doGet(AdapterInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null) { if (0 > $beta = $beta ?? 1.0) { - throw new InvalidArgumentException(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', \get_class($this), $beta)); + throw new InvalidArgumentException(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', static::class, $beta)); } static $setMetadata; diff --git a/src/Symfony/Component/Cache/Traits/PdoTrait.php b/src/Symfony/Component/Cache/Traits/PdoTrait.php index 73f8c6465e3bf..f927b4ec47d31 100644 --- a/src/Symfony/Component/Cache/Traits/PdoTrait.php +++ b/src/Symfony/Component/Cache/Traits/PdoTrait.php @@ -403,7 +403,7 @@ private function getConnection() } else { switch ($this->driver = $this->conn->getDriver()->getName()) { case 'mysqli': - throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', \get_class($this))); + throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class)); case 'pdo_mysql': case 'drizzle_pdo_mysql': $this->driver = 'mysql'; diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php index 076d175807c74..33dd92781065e 100644 --- a/src/Symfony/Component/Config/Definition/BaseNode.php +++ b/src/Symfony/Component/Config/Definition/BaseNode.php @@ -524,7 +524,7 @@ private static function resolvePlaceholderValue($value) private function doValidateType($value): void { if (null !== $this->handlingPlaceholder && !$this->allowPlaceholders()) { - $e = new InvalidTypeException(sprintf('A dynamic value is not compatible with a "%s" node type at path "%s".', \get_class($this), $this->getPath())); + $e = new InvalidTypeException(sprintf('A dynamic value is not compatible with a "%s" node type at path "%s".', static::class, $this->getPath())); $e->setPath($this->getPath()); throw $e; diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php index dc2e5e3380d6a..61cb081c9731f 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php @@ -362,7 +362,7 @@ public function setPathSeparator(string $separator) $child->setPathSeparator($separator); } } else { - @trigger_error(sprintf('Not implementing the "%s::getChildNodeDefinitions()" method in "%s" is deprecated since Symfony 4.1.', ParentNodeDefinitionInterface::class, \get_class($this)), E_USER_DEPRECATED); + @trigger_error(sprintf('Not implementing the "%s::getChildNodeDefinitions()" method in "%s" is deprecated since Symfony 4.1.', ParentNodeDefinitionInterface::class, static::class), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php index 828ac672124fe..5055e1747e7e0 100644 --- a/src/Symfony/Component/Config/Loader/FileLoader.php +++ b/src/Symfony/Component/Config/Loader/FileLoader.php @@ -73,7 +73,7 @@ public function getLocator() */ public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null/*, $exclude = null*/) { - if (\func_num_args() < 5 && __CLASS__ !== \get_class($this) && 0 !== strpos(\get_class($this), 'Symfony\Component\\') && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + if (\func_num_args() < 5 && __CLASS__ !== static::class && 0 !== strpos(static::class, 'Symfony\Component\\') && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @trigger_error(sprintf('The "%s()" method will have a new "$exclude = null" argument in version 5.0, not defining it is deprecated since Symfony 4.4.', __METHOD__), E_USER_DEPRECATED); } $exclude = \func_num_args() >= 5 ? func_get_arg(4) : null; diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 1b15e7941dab3..410900cc2bcfa 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -805,7 +805,7 @@ public function renderException(\Exception $e, OutputInterface $output) public function renderThrowable(\Throwable $e, OutputInterface $output): void { - if (__CLASS__ !== \get_class($this) && __CLASS__ === (new \ReflectionMethod($this, 'renderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'renderException'))->getDeclaringClass()->getName()) { + if (__CLASS__ !== static::class && __CLASS__ === (new \ReflectionMethod($this, 'renderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'renderException'))->getDeclaringClass()->getName()) { @trigger_error(sprintf('The "%s::renderException()" method is deprecated since Symfony 4.4, use "renderThrowable()" instead.', __CLASS__), E_USER_DEPRECATED); if (!$e instanceof \Exception) { @@ -844,7 +844,7 @@ protected function doRenderException(\Exception $e, OutputInterface $output) protected function doRenderThrowable(\Throwable $e, OutputInterface $output): void { - if (__CLASS__ !== \get_class($this) && __CLASS__ === (new \ReflectionMethod($this, 'doRenderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'doRenderException'))->getDeclaringClass()->getName()) { + if (__CLASS__ !== static::class && __CLASS__ === (new \ReflectionMethod($this, 'doRenderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'doRenderException'))->getDeclaringClass()->getName()) { @trigger_error(sprintf('The "%s::doRenderException()" method is deprecated since Symfony 4.4, use "doRenderThrowable()" instead.', __CLASS__), E_USER_DEPRECATED); if (!$e instanceof \Exception) { diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index bceb318271162..84aceafc16657 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -255,7 +255,7 @@ public function run(InputInterface $input, OutputInterface $output) $statusCode = $this->execute($input, $output); if (!\is_int($statusCode)) { - @trigger_error(sprintf('Return value of "%s::execute()" should always be of the type int since Symfony 4.4, %s returned.', \get_class($this), \gettype($statusCode)), E_USER_DEPRECATED); + @trigger_error(sprintf('Return value of "%s::execute()" should always be of the type int since Symfony 4.4, %s returned.', static::class, \gettype($statusCode)), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 40a5eb835b959..b2f300fb73b45 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -897,8 +897,7 @@ public function testRenderAnonymousException() $application = new Application(); $application->setAutoExit(false); $application->register('foo')->setCode(function () { - throw new class('') extends \InvalidArgumentException { - }; + throw new class('') extends \InvalidArgumentException { }; }); $tester = new ApplicationTester($application); @@ -908,8 +907,7 @@ public function testRenderAnonymousException() $application = new Application(); $application->setAutoExit(false); $application->register('foo')->setCode(function () { - throw new \InvalidArgumentException(sprintf('Dummy type "%s" is invalid.', \get_class(new class() { - }))); + throw new \InvalidArgumentException(sprintf('Dummy type "%s" is invalid.', \get_class(new class() { }))); }); $tester = new ApplicationTester($application); @@ -922,8 +920,7 @@ public function testRenderExceptionStackTraceContainsRootException() $application = new Application(); $application->setAutoExit(false); $application->register('foo')->setCode(function () { - throw new class('') extends \InvalidArgumentException { - }; + throw new class('') extends \InvalidArgumentException { }; }); $tester = new ApplicationTester($application); @@ -933,8 +930,7 @@ public function testRenderExceptionStackTraceContainsRootException() $application = new Application(); $application->setAutoExit(false); $application->register('foo')->setCode(function () { - throw new \InvalidArgumentException(sprintf('Dummy type "%s" is invalid.', \get_class(new class() { - }))); + throw new \InvalidArgumentException(sprintf('Dummy type "%s" is invalid.', \get_class(new class() { }))); }); $tester = new ApplicationTester($application); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php index ad3cb5295cc7e..02a18b6cf09ca 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php @@ -214,7 +214,7 @@ private function getExpressionLanguage(): ExpressionLanguage $arg = $this->processValue(new Reference($id)); $this->inExpression = false; if (!$arg instanceof Reference) { - throw new RuntimeException(sprintf('"%s::processValue()" must return a Reference when processing an expression, %s returned for service("%s").', \get_class($this), \is_object($arg) ? \get_class($arg) : \gettype($arg), $id)); + throw new RuntimeException(sprintf('"%s::processValue()" must return a Reference when processing an expression, %s returned for service("%s").', static::class, \is_object($arg) ? \get_class($arg) : \gettype($arg), $id)); } $arg = sprintf('"%s"', $arg); } diff --git a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php index d6f6fae01d49a..61614464bc026 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php @@ -58,7 +58,7 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe if ($ignoreNotFound = 'not_found' === $ignoreErrors) { $args[2] = false; } elseif (!\is_bool($ignoreErrors)) { - @trigger_error(sprintf('Invalid argument $ignoreErrors provided to %s::import(): boolean or "not_found" expected, %s given.', \get_class($this), \gettype($ignoreErrors)), E_USER_DEPRECATED); + @trigger_error(sprintf('Invalid argument $ignoreErrors provided to %s::import(): boolean or "not_found" expected, %s given.', static::class, \gettype($ignoreErrors)), E_USER_DEPRECATED); $args[2] = (bool) $ignoreErrors; } diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 1be828e999a91..e89476f1229dc 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -533,7 +533,7 @@ public function parents() */ public function children(/* string $selector = null */) { - 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) { + if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @trigger_error(sprintf('The "%s()" method will have a new "string $selector = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } $selector = 0 < \func_num_args() ? func_get_arg(0) : null; diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcher.php b/src/Symfony/Component/EventDispatcher/EventDispatcher.php index e1e7366bed6aa..bd2874ba6c484 100644 --- a/src/Symfony/Component/EventDispatcher/EventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/EventDispatcher.php @@ -38,7 +38,7 @@ class EventDispatcher implements EventDispatcherInterface public function __construct() { - if (__CLASS__ === \get_class($this)) { + if (__CLASS__ === static::class) { $this->optimized = []; } } diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index ecc3515ed1019..4d271a0562721 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -440,7 +440,7 @@ public function sort(\Closure $closure) */ public function sortByName(/* bool $useNaturalSort = false */) { - 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) { + if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @trigger_error(sprintf('The "%s()" method will have a new "bool $useNaturalSort = false" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } $useNaturalSort = 0 < \func_num_args() && func_get_arg(0); diff --git a/src/Symfony/Component/Form/AbstractTypeExtension.php b/src/Symfony/Component/Form/AbstractTypeExtension.php index 2305db89ee443..0388f7c012919 100644 --- a/src/Symfony/Component/Form/AbstractTypeExtension.php +++ b/src/Symfony/Component/Form/AbstractTypeExtension.php @@ -58,7 +58,7 @@ public function getExtendedType() throw new LogicException(sprintf('You need to implement the static getExtendedTypes() method when implementing the %s in %s.', FormTypeExtensionInterface::class, static::class)); } - @trigger_error(sprintf('The %s::getExtendedType() method is deprecated since Symfony 4.2 and will be removed in 5.0. Use getExtendedTypes() instead.', \get_class($this)), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s::getExtendedType() method is deprecated since Symfony 4.2 and will be removed in 5.0. Use getExtendedTypes() instead.', static::class), E_USER_DEPRECATED); foreach (static::getExtendedTypes() as $extendedType) { return $extendedType; diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index 2baf51ac2b97f..e860557468024 100644 --- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -120,7 +120,7 @@ abstract protected function renderLabel(FormView $view, $label = null, array $va protected function renderHelp(FormView $view) { - $this->markTestSkipped(sprintf('%s::renderHelp() is not implemented.', \get_class($this))); + $this->markTestSkipped(sprintf('%s::renderHelp() is not implemented.', static::class)); } abstract protected function renderErrors(FormView $view); diff --git a/src/Symfony/Component/HttpClient/HttpClientTrait.php b/src/Symfony/Component/HttpClient/HttpClientTrait.php index 2486f04bc8c8c..3eeb52fdd5cea 100644 --- a/src/Symfony/Component/HttpClient/HttpClientTrait.php +++ b/src/Symfony/Component/HttpClient/HttpClientTrait.php @@ -341,7 +341,7 @@ private static function jsonEncode($value, int $flags = null, int $maxDepth = 51 $flags = $flags ?? (JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRESERVE_ZERO_FRACTION); try { - $value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0), $maxDepth); + $value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0), $maxDepth); } catch (\JsonException $e) { throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', $e->getMessage())); } diff --git a/src/Symfony/Component/HttpClient/Response/CurlResponse.php b/src/Symfony/Component/HttpClient/Response/CurlResponse.php index e1699b9b2b7ba..c497cfc4fdd1f 100644 --- a/src/Symfony/Component/HttpClient/Response/CurlResponse.php +++ b/src/Symfony/Component/HttpClient/Response/CurlResponse.php @@ -262,7 +262,7 @@ private static function perform(CurlClientState $multi, array &$responses = null $id = (int) $ch = $info['handle']; $waitFor = @curl_getinfo($ch, CURLINFO_PRIVATE) ?: '_0'; - if (\in_array($result, [\CURLE_SEND_ERROR, \CURLE_RECV_ERROR, /*CURLE_HTTP2*/ 16, /*CURLE_HTTP2_STREAM*/ 92], true) && $waitFor[1] && 'C' !== $waitFor[0]) { + if (\in_array($result, [CURLE_SEND_ERROR, CURLE_RECV_ERROR, /*CURLE_HTTP2*/ 16, /*CURLE_HTTP2_STREAM*/ 92], true) && $waitFor[1] && 'C' !== $waitFor[0]) { curl_multi_remove_handle($multi->handle, $ch); $waitFor[1] = (string) ((int) $waitFor[1] - 1); // decrement the retry counter curl_setopt($ch, CURLOPT_PRIVATE, $waitFor); @@ -277,7 +277,7 @@ private static function perform(CurlClientState $multi, array &$responses = null } $multi->handlesActivity[$id][] = null; - $multi->handlesActivity[$id][] = \in_array($result, [\CURLE_OK, \CURLE_TOO_MANY_REDIRECTS], true) || '_0' === $waitFor || curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD) === curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD) ? null : new TransportException(sprintf('%s for "%s".', curl_strerror($result), curl_getinfo($ch, CURLINFO_EFFECTIVE_URL))); + $multi->handlesActivity[$id][] = \in_array($result, [CURLE_OK, CURLE_TOO_MANY_REDIRECTS], true) || '_0' === $waitFor || curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD) === curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD) ? null : new TransportException(sprintf('%s for "%s".', curl_strerror($result), curl_getinfo($ch, CURLINFO_EFFECTIVE_URL))); } } finally { self::$performing = false; diff --git a/src/Symfony/Component/HttpClient/Response/ResponseTrait.php b/src/Symfony/Component/HttpClient/Response/ResponseTrait.php index b7b576e564e8a..8793a45184c61 100644 --- a/src/Symfony/Component/HttpClient/Response/ResponseTrait.php +++ b/src/Symfony/Component/HttpClient/Response/ResponseTrait.php @@ -151,7 +151,7 @@ public function toArray(bool $throw = true): array } try { - $content = json_decode($content, true, 512, JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0)); + $content = json_decode($content, true, 512, JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0)); } catch (\JsonException $e) { throw new JsonException($e->getMessage(), $e->getCode()); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index 206ff48777e95..b4fad768834ff 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -61,12 +61,12 @@ public function testPhpSession() { $storage = $this->getStorage(); - $this->assertNotSame(\PHP_SESSION_ACTIVE, session_status()); + $this->assertNotSame(PHP_SESSION_ACTIVE, session_status()); $this->assertFalse($storage->isStarted()); session_start(); $this->assertTrue(isset($_SESSION)); - $this->assertSame(\PHP_SESSION_ACTIVE, session_status()); + $this->assertSame(PHP_SESSION_ACTIVE, session_status()); // PHP session might have started, but the storage driver has not, so false is correct here $this->assertFalse($storage->isStarted()); diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index d6c3976e4d237..b124ebe6344bc 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -228,7 +228,7 @@ public function getBundles() public function getBundle($name) { if (!isset($this->bundles[$name])) { - $class = \get_class($this); + $class = static::class; $class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class; throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, $class)); @@ -473,7 +473,7 @@ protected function build(ContainerBuilder $container) */ protected function getContainerClass() { - $class = \get_class($this); + $class = static::class; $class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).str_replace('.', '_', ContainerBuilder::hash($class)) : $class; $class = $this->name.str_replace('\\', '_', $class).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container'; @@ -510,7 +510,7 @@ protected function initializeContainer() $cachePath = $cache->getPath(); // Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors - $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); + $errorLevel = error_reporting(E_ALL ^ E_WARNING); try { if (file_exists($cachePath) && \is_object($this->container = include $cachePath) diff --git a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php index 8cf0ae52abe13..9584dec23c4d5 100644 --- a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php @@ -67,7 +67,7 @@ protected function preGenerate() // Write parents locale file for the Translation component file_put_contents( __DIR__.'/../../../Translation/Resources/data/parents.json', - json_encode($this->localeParents, \JSON_PRETTY_PRINT).\PHP_EOL + json_encode($this->localeParents, JSON_PRETTY_PRINT).PHP_EOL ); } diff --git a/src/Symfony/Component/Lock/Store/CombinedStore.php b/src/Symfony/Component/Lock/Store/CombinedStore.php index 3553d6ffb78e0..0b3698335754d 100644 --- a/src/Symfony/Component/Lock/Store/CombinedStore.php +++ b/src/Symfony/Component/Lock/Store/CombinedStore.php @@ -100,7 +100,7 @@ public function save(Key $key) public function waitAndSave(Key $key) { @trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__), E_USER_DEPRECATED); - throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', static::class)); } /** diff --git a/src/Symfony/Component/Lock/Store/MemcachedStore.php b/src/Symfony/Component/Lock/Store/MemcachedStore.php index 23e2ee8121484..beb4db0d438fe 100644 --- a/src/Symfony/Component/Lock/Store/MemcachedStore.php +++ b/src/Symfony/Component/Lock/Store/MemcachedStore.php @@ -77,7 +77,7 @@ public function save(Key $key) public function waitAndSave(Key $key) { @trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__), E_USER_DEPRECATED); - throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', static::class)); } /** diff --git a/src/Symfony/Component/Lock/Store/PdoStore.php b/src/Symfony/Component/Lock/Store/PdoStore.php index bd9df9e56ccdb..78d8ab6c9c9d0 100644 --- a/src/Symfony/Component/Lock/Store/PdoStore.php +++ b/src/Symfony/Component/Lock/Store/PdoStore.php @@ -317,7 +317,7 @@ private function getDriver(): string } else { switch ($this->driver = $con->getDriver()->getName()) { case 'mysqli': - throw new NotSupportedException(sprintf('The store "%s" does not support the mysqli driver, use pdo_mysql instead.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class)); case 'pdo_mysql': case 'drizzle_pdo_mysql': $this->driver = 'mysql'; diff --git a/src/Symfony/Component/Lock/Store/RedisStore.php b/src/Symfony/Component/Lock/Store/RedisStore.php index d8c382579c506..22262b84e2e1a 100644 --- a/src/Symfony/Component/Lock/Store/RedisStore.php +++ b/src/Symfony/Component/Lock/Store/RedisStore.php @@ -81,7 +81,7 @@ public function save(Key $key) public function waitAndSave(Key $key) { @trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__), E_USER_DEPRECATED); - throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', static::class)); } /** diff --git a/src/Symfony/Component/Messenger/HandleTrait.php b/src/Symfony/Component/Messenger/HandleTrait.php index 27c7d84d217c4..7ba5deb7c0259 100644 --- a/src/Symfony/Component/Messenger/HandleTrait.php +++ b/src/Symfony/Component/Messenger/HandleTrait.php @@ -37,7 +37,7 @@ trait HandleTrait private function handle($message) { if (!$this->messageBus instanceof MessageBusInterface) { - throw new LogicException(sprintf('You must provide a "%s" instance in the "%s::$messageBus" property, "%s" given.', MessageBusInterface::class, \get_class($this), \is_object($this->messageBus) ? \get_class($this->messageBus) : \gettype($this->messageBus))); + throw new LogicException(sprintf('You must provide a "%s" instance in the "%s::$messageBus" property, "%s" given.', MessageBusInterface::class, static::class, \is_object($this->messageBus) ? \get_class($this->messageBus) : \gettype($this->messageBus))); } $envelope = $this->messageBus->dispatch($message); @@ -45,7 +45,7 @@ private function handle($message) $handledStamps = $envelope->all(HandledStamp::class); if (!$handledStamps) { - throw new LogicException(sprintf('Message of type "%s" was handled zero times. Exactly one handler is expected when using "%s::%s()".', \get_class($envelope->getMessage()), \get_class($this), __FUNCTION__)); + throw new LogicException(sprintf('Message of type "%s" was handled zero times. Exactly one handler is expected when using "%s::%s()".', \get_class($envelope->getMessage()), static::class, __FUNCTION__)); } if (\count($handledStamps) > 1) { @@ -53,7 +53,7 @@ private function handle($message) return sprintf('"%s"', $stamp->getHandlerName()); }, $handledStamps)); - throw new LogicException(sprintf('Message of type "%s" was handled multiple times. Only one handler is expected when using "%s::%s()", got %d: %s.', \get_class($envelope->getMessage()), \get_class($this), __FUNCTION__, \count($handledStamps), $handlers)); + throw new LogicException(sprintf('Message of type "%s" was handled multiple times. Only one handler is expected when using "%s::%s()", got %d: %s.', \get_class($envelope->getMessage()), static::class, __FUNCTION__, \count($handledStamps), $handlers)); } return $handledStamps[0]->getResult(); diff --git a/src/Symfony/Component/Mime/Encoder/Base64ContentEncoder.php b/src/Symfony/Component/Mime/Encoder/Base64ContentEncoder.php index 338490b3e5909..cb7f911678863 100644 --- a/src/Symfony/Component/Mime/Encoder/Base64ContentEncoder.php +++ b/src/Symfony/Component/Mime/Encoder/Base64ContentEncoder.php @@ -24,7 +24,7 @@ public function encodeByteStream($stream, int $maxLineLength = 0): iterable throw new \TypeError(sprintf('Method "%s" takes a stream as a first argument.', __METHOD__)); } - $filter = stream_filter_append($stream, 'convert.base64-encode', \STREAM_FILTER_READ, [ + $filter = stream_filter_append($stream, 'convert.base64-encode', STREAM_FILTER_READ, [ 'line-length' => 0 >= $maxLineLength || 76 < $maxLineLength ? 76 : $maxLineLength, 'line-break-chars' => "\r\n", ]); diff --git a/src/Symfony/Component/Mime/Encoder/QpEncoder.php b/src/Symfony/Component/Mime/Encoder/QpEncoder.php index ff9b0cc12e08c..4f249e069ee95 100644 --- a/src/Symfony/Component/Mime/Encoder/QpEncoder.php +++ b/src/Symfony/Component/Mime/Encoder/QpEncoder.php @@ -89,7 +89,7 @@ class QpEncoder implements EncoderInterface public function __construct() { - $id = \get_class($this); + $id = static::class; if (!isset(self::$safeMapShare[$id])) { $this->initSafeMap(); self::$safeMapShare[$id] = $this->safeMap; diff --git a/src/Symfony/Component/Routing/Annotation/Route.php b/src/Symfony/Component/Routing/Annotation/Route.php index 75e9cb0ecbc3a..8183b6fc55e97 100644 --- a/src/Symfony/Component/Routing/Annotation/Route.php +++ b/src/Symfony/Component/Routing/Annotation/Route.php @@ -43,7 +43,7 @@ class Route public function __construct(array $data) { if (isset($data['localized_paths'])) { - throw new \BadMethodCallException(sprintf('Unknown property "localized_paths" on annotation "%s".', \get_class($this))); + throw new \BadMethodCallException(sprintf('Unknown property "localized_paths" on annotation "%s".', static::class)); } if (isset($data['value'])) { diff --git a/src/Symfony/Component/Routing/Loader/ObjectLoader.php b/src/Symfony/Component/Routing/Loader/ObjectLoader.php index 16dd6c9a36fb2..e4bcfc9efa3ea 100644 --- a/src/Symfony/Component/Routing/Loader/ObjectLoader.php +++ b/src/Symfony/Component/Routing/Loader/ObjectLoader.php @@ -57,7 +57,7 @@ public function load($resource, $type = null) $loaderObject = $this->getObject($parts[0]); if (!\is_object($loaderObject)) { - throw new \TypeError(sprintf('%s:getObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject))); + throw new \TypeError(sprintf('%s:getObject() must return an object: %s returned', static::class, \gettype($loaderObject))); } if (!\is_callable([$loaderObject, $method])) { diff --git a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php index f5b4226ab5941..8fac4945949c1 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php @@ -38,9 +38,9 @@ public function __construct(int $memoryCost = null, int $timeCost = null, int $t { if (\defined('PASSWORD_ARGON2I')) { $this->config = [ - 'memory_cost' => $memoryCost ?? \PASSWORD_ARGON2_DEFAULT_MEMORY_COST, - 'time_cost' => $timeCost ?? \PASSWORD_ARGON2_DEFAULT_TIME_COST, - 'threads' => $threads ?? \PASSWORD_ARGON2_DEFAULT_THREADS, + 'memory_cost' => $memoryCost ?? PASSWORD_ARGON2_DEFAULT_MEMORY_COST, + 'time_cost' => $timeCost ?? PASSWORD_ARGON2_DEFAULT_TIME_COST, + 'threads' => $threads ?? PASSWORD_ARGON2_DEFAULT_THREADS, ]; } } diff --git a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php index 4ffa38d38e3b9..10b96dc506de1 100644 --- a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php @@ -33,8 +33,8 @@ final class NativePasswordEncoder implements PasswordEncoderInterface, SelfSalti public function __construct(int $opsLimit = null, int $memLimit = null, int $cost = null, string $algo = null) { $cost = $cost ?? 13; - $opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4); - $memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 1024); + $opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4); + $memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 1024); if (3 > $opsLimit) { throw new \InvalidArgumentException('$opsLimit must be 3 or greater.'); @@ -89,7 +89,7 @@ public function isPasswordValid($encoded, $raw, $salt): bool return (72 >= \strlen($raw) || 0 !== strpos($encoded, '$2')) && password_verify($raw, $encoded); } - if (\extension_loaded('sodium') && version_compare(\SODIUM_LIBRARY_VERSION, '1.0.14', '>=')) { + if (\extension_loaded('sodium') && version_compare(SODIUM_LIBRARY_VERSION, '1.0.14', '>=')) { return sodium_crypto_pwhash_str_verify($encoded, $raw); } diff --git a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php index 35291ed31dc7d..0d552d165bbfb 100644 --- a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php @@ -34,8 +34,8 @@ public function __construct(int $opsLimit = null, int $memLimit = null) throw new LogicException('Libsodium is not available. You should either install the sodium extension, upgrade to PHP 7.2+ or use a different encoder.'); } - $this->opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4); - $this->memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 2014); + $this->opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4); + $this->memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 2014); if (3 > $this->opsLimit) { throw new \InvalidArgumentException('$opsLimit must be 3 or greater.'); @@ -48,7 +48,7 @@ public function __construct(int $opsLimit = null, int $memLimit = null) public static function isSupported(): bool { - return version_compare(\extension_loaded('sodium') ? \SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.14', '>='); + return version_compare(\extension_loaded('sodium') ? SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.14', '>='); } /** diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php index 44cecafecd2ba..e77307d65dfc3 100644 --- a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php @@ -150,7 +150,7 @@ public function testMigrateFrom() $this->assertInstanceOf(MigratingPasswordEncoder::class, $encoder); $this->assertTrue($encoder->isPasswordValid((new SodiumPasswordEncoder())->encodePassword('foo', null), 'foo', null)); - $this->assertTrue($encoder->isPasswordValid((new NativePasswordEncoder(null, null, null, \PASSWORD_BCRYPT))->encodePassword('foo', null), 'foo', null)); + $this->assertTrue($encoder->isPasswordValid((new NativePasswordEncoder(null, null, null, PASSWORD_BCRYPT))->encodePassword('foo', null), 'foo', null)); $this->assertTrue($encoder->isPasswordValid($digest->encodePassword('foo', null), 'foo', null)); $this->assertStringStartsWith(SODIUM_CRYPTO_PWHASH_STRPREFIX, $encoder->encodePassword('foo', null)); } diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php index 092f3e7eb6ae6..0d05319068cea 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php @@ -352,8 +352,9 @@ protected function runSessionOnKernelResponse($newToken, $original = null) $session->set('_security_session', $original); } - $tokenStorage = new UsageTrackingTokenStorage(new TokenStorage(), new class([ - 'session' => function () use ($session) { return $session; } + $tokenStorage = new UsageTrackingTokenStorage(new TokenStorage(), new class(['session' => function () use ($session) { + return $session; + }, ]) implements ContainerInterface { use ServiceLocatorTrait; }); @@ -404,8 +405,9 @@ private function handleEventWithPreviousSession($userProviders, UserInterface $u if (method_exists(Request::class, 'getPreferredFormat')) { $usageIndex = $session->getUsageIndex(); - $tokenStorage = new UsageTrackingTokenStorage($tokenStorage, new class([ - 'session' => function () use ($session) { return $session; } + $tokenStorage = new UsageTrackingTokenStorage($tokenStorage, new class(['session' => function () use ($session) { + return $session; + }, ]) implements ContainerInterface { use ServiceLocatorTrait; }); diff --git a/src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php b/src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php index 1e0077c27a712..c1184a53a5f6a 100644 --- a/src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php +++ b/src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php @@ -39,11 +39,11 @@ class DiscriminatorMap public function __construct(array $data) { if (empty($data['typeProperty'])) { - throw new InvalidArgumentException(sprintf('Parameter "typeProperty" of annotation "%s" cannot be empty.', \get_class($this))); + throw new InvalidArgumentException(sprintf('Parameter "typeProperty" of annotation "%s" cannot be empty.', static::class)); } if (empty($data['mapping'])) { - throw new InvalidArgumentException(sprintf('Parameter "mapping" of annotation "%s" cannot be empty.', \get_class($this))); + throw new InvalidArgumentException(sprintf('Parameter "mapping" of annotation "%s" cannot be empty.', static::class)); } $this->typeProperty = $data['typeProperty']; diff --git a/src/Symfony/Component/Serializer/Annotation/SerializedName.php b/src/Symfony/Component/Serializer/Annotation/SerializedName.php index 2de4a2c42274d..747c8c55f108b 100644 --- a/src/Symfony/Component/Serializer/Annotation/SerializedName.php +++ b/src/Symfony/Component/Serializer/Annotation/SerializedName.php @@ -31,11 +31,11 @@ final class SerializedName public function __construct(array $data) { if (!isset($data['value'])) { - throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', \get_class($this))); + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', static::class)); } if (!\is_string($data['value']) || empty($data['value'])) { - throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a non-empty string.', \get_class($this))); + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a non-empty string.', static::class)); } $this->serializedName = $data['value']; diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index a49c1b6b25308..3506899b45420 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -316,7 +316,7 @@ protected function isCircularReference($object, &$context) */ protected function handleCircularReference($object/*, string $format = null, array $context = []*/) { - if (\func_num_args() < 2 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + if (\func_num_args() < 2 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @trigger_error(sprintf('The "%s()" method will have two new "string $format = null" and "array $context = []" arguments in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } $format = \func_num_args() > 1 ? func_get_arg(1) : null; @@ -549,7 +549,7 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara protected function createChildContext(array $parentContext, $attribute/*, ?string $format */): array { if (\func_num_args() < 3) { - @trigger_error(sprintf('Method "%s::%s()" will have a third "?string $format" argument in version 5.0; not defining it is deprecated since Symfony 4.3.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method "%s::%s()" will have a third "?string $format" argument in version 5.0; not defining it is deprecated since Symfony 4.3.', static::class, __FUNCTION__), E_USER_DEPRECATED); } if (isset($parentContext[self::ATTRIBUTES][$attribute])) { $parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute]; diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 1f0c33d77d4f3..12d5b30f16b9a 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -594,7 +594,7 @@ protected function createChildContext(array $parentContext, $attribute/*, ?strin if (\func_num_args() >= 3) { $format = func_get_arg(2); } else { - @trigger_error(sprintf('Method "%s::%s()" will have a third "?string $format" argument in version 5.0; not defining it is deprecated since Symfony 4.3.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method "%s::%s()" will have a third "?string $format" argument in version 5.0; not defining it is deprecated since Symfony 4.3.', static::class, __FUNCTION__), E_USER_DEPRECATED); $format = null; } diff --git a/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php index 9437375f20db5..36373d9f5c32b 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php @@ -93,6 +93,6 @@ public function supportsNormalization($data, $format = null) */ public function hasCacheableSupportsMethod(): bool { - return __CLASS__ === \get_class($this); + return __CLASS__ === static::class; } } diff --git a/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php index c4f70a9609b31..43d1c217c6e08 100644 --- a/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php @@ -73,6 +73,6 @@ public function supportsDenormalization($data, $type, $format = null) */ public function hasCacheableSupportsMethod(): bool { - return __CLASS__ === \get_class($this); + return __CLASS__ === static::class; } } diff --git a/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php index ca37e6a273714..a26d0bb57bef1 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php @@ -138,7 +138,7 @@ public function supportsDenormalization($data, $type, $format = null) */ public function hasCacheableSupportsMethod(): bool { - return __CLASS__ === \get_class($this); + return __CLASS__ === static::class; } /** diff --git a/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php index f4d0045d840ae..214781fa92dcc 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php @@ -69,7 +69,7 @@ public function supportsNormalization($data, $format = null) */ public function hasCacheableSupportsMethod(): bool { - return __CLASS__ === \get_class($this); + return __CLASS__ === static::class; } /** diff --git a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php index 8ce62c0f06af9..a783d2018ac3f 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php @@ -129,7 +129,7 @@ public function supportsDenormalization($data, $type, $format = null) */ public function hasCacheableSupportsMethod(): bool { - return __CLASS__ === \get_class($this); + return __CLASS__ === static::class; } /** diff --git a/src/Symfony/Component/Serializer/Normalizer/DateTimeZoneNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateTimeZoneNormalizer.php index ba013b0e79635..519381b22388a 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DateTimeZoneNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DateTimeZoneNormalizer.php @@ -74,6 +74,6 @@ public function supportsDenormalization($data, $type, $format = null) */ public function hasCacheableSupportsMethod(): bool { - return __CLASS__ === \get_class($this); + return __CLASS__ === static::class; } } diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php index 5579c9ca3505b..0c289729d0f27 100644 --- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php @@ -57,7 +57,7 @@ public function supportsDenormalization($data, $type, $format = null) */ public function hasCacheableSupportsMethod(): bool { - return __CLASS__ === \get_class($this); + return __CLASS__ === static::class; } /** diff --git a/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php index b4212c005798c..6397322605785 100644 --- a/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php @@ -70,6 +70,6 @@ public function denormalize($data, $type, $format = null, array $context = []) */ public function hasCacheableSupportsMethod(): bool { - return __CLASS__ === \get_class($this); + return __CLASS__ === static::class; } } diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index 7b68fa604ee24..a71313f1cc038 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -54,7 +54,7 @@ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory */ public function hasCacheableSupportsMethod(): bool { - return __CLASS__ === \get_class($this); + return __CLASS__ === static::class; } /** diff --git a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php index c0df2b2ce6e38..9e2a53216e001 100644 --- a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php @@ -51,7 +51,7 @@ public function supportsDenormalization($data, $type, $format = null) */ public function hasCacheableSupportsMethod(): bool { - return __CLASS__ === \get_class($this); + return __CLASS__ === static::class; } /** diff --git a/src/Symfony/Component/Translation/Extractor/PhpExtractor.php b/src/Symfony/Component/Translation/Extractor/PhpExtractor.php index 265b8d76841fe..5237bf6625f2c 100644 --- a/src/Symfony/Component/Translation/Extractor/PhpExtractor.php +++ b/src/Symfony/Component/Translation/Extractor/PhpExtractor.php @@ -200,7 +200,7 @@ private function getValue(\Iterator $tokenIterator) */ protected function parseTokens($tokens, MessageCatalogue $catalog/*, string $filename*/) { - if (\func_num_args() < 3 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + if (\func_num_args() < 3 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @trigger_error(sprintf('The "%s()" method will have a new "string $filename" argument in version 5.0, not defining it is deprecated since Symfony 4.3.', __METHOD__), E_USER_DEPRECATED); } $filename = 2 < \func_num_args() ? func_get_arg(2) : ''; diff --git a/src/Symfony/Component/Translation/IdentityTranslator.php b/src/Symfony/Component/Translation/IdentityTranslator.php index 9a5a47c209b46..87b40bf8faa6e 100644 --- a/src/Symfony/Component/Translation/IdentityTranslator.php +++ b/src/Symfony/Component/Translation/IdentityTranslator.php @@ -33,7 +33,7 @@ public function __construct(MessageSelector $selector = null) { $this->selector = $selector; - if (__CLASS__ !== \get_class($this)) { + if (__CLASS__ !== static::class) { @trigger_error(sprintf('Calling "%s()" is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparison.php b/src/Symfony/Component/Validator/Constraints/AbstractComparison.php index dccc327c30463..9b5281296a17e 100644 --- a/src/Symfony/Component/Validator/Constraints/AbstractComparison.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparison.php @@ -47,7 +47,7 @@ public function __construct($options = null) } if (isset($options['propertyPath']) && !class_exists(PropertyAccess::class)) { - throw new LogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option.', \get_class($this))); + throw new LogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option.', static::class)); } } diff --git a/src/Symfony/Component/Validator/Constraints/NumberConstraintTrait.php b/src/Symfony/Component/Validator/Constraints/NumberConstraintTrait.php index ff189cf3e8acb..2913f7e882d72 100644 --- a/src/Symfony/Component/Validator/Constraints/NumberConstraintTrait.php +++ b/src/Symfony/Component/Validator/Constraints/NumberConstraintTrait.php @@ -27,11 +27,11 @@ private function configureNumberConstraintOptions($options): array } if (isset($options['propertyPath'])) { - throw new ConstraintDefinitionException(sprintf('The "propertyPath" option of the "%s" constraint cannot be set.', \get_class($this))); + throw new ConstraintDefinitionException(sprintf('The "propertyPath" option of the "%s" constraint cannot be set.', static::class)); } if (isset($options['value'])) { - throw new ConstraintDefinitionException(sprintf('The "value" option of the "%s" constraint cannot be set.', \get_class($this))); + throw new ConstraintDefinitionException(sprintf('The "value" option of the "%s" constraint cannot be set.', static::class)); } $options['value'] = 0; diff --git a/src/Symfony/Component/Validator/Constraints/Range.php b/src/Symfony/Component/Validator/Constraints/Range.php index 9f05edf677ffb..a916a9625b9e0 100644 --- a/src/Symfony/Component/Validator/Constraints/Range.php +++ b/src/Symfony/Component/Validator/Constraints/Range.php @@ -50,15 +50,15 @@ public function __construct($options = null) { if (\is_array($options)) { if (isset($options['min']) && isset($options['minPropertyPath'])) { - throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "min" or "minPropertyPath" options to be set, not both.', \get_class($this))); + throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "min" or "minPropertyPath" options to be set, not both.', static::class)); } if (isset($options['max']) && isset($options['maxPropertyPath'])) { - throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "max" or "maxPropertyPath" options to be set, not both.', \get_class($this))); + throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "max" or "maxPropertyPath" options to be set, not both.', static::class)); } if ((isset($options['minPropertyPath']) || isset($options['maxPropertyPath'])) && !class_exists(PropertyAccess::class)) { - throw new LogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "minPropertyPath" or "maxPropertyPath" option.', \get_class($this))); + throw new LogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "minPropertyPath" or "maxPropertyPath" option.', static::class)); } } diff --git a/src/Symfony/Component/VarDumper/Resources/functions/dump.php b/src/Symfony/Component/VarDumper/Resources/functions/dump.php index e1543a8df8fe9..a485d573a007a 100644 --- a/src/Symfony/Component/VarDumper/Resources/functions/dump.php +++ b/src/Symfony/Component/VarDumper/Resources/functions/dump.php @@ -38,6 +38,6 @@ function dd(...$vars) VarDumper::dump($v); } - die(1); + exit(1); } } diff --git a/src/Symfony/Contracts/Cache/CacheTrait.php b/src/Symfony/Contracts/Cache/CacheTrait.php index 355ea2962ebdc..eda3d4931a158 100644 --- a/src/Symfony/Contracts/Cache/CacheTrait.php +++ b/src/Symfony/Contracts/Cache/CacheTrait.php @@ -41,8 +41,7 @@ public function delete(string $key): bool private function doGet(CacheItemPoolInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null, LoggerInterface $logger = null) { if (0 > $beta = $beta ?? 1.0) { - throw new class(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', \get_class($this), $beta)) extends \InvalidArgumentException implements InvalidArgumentException { - }; + throw new class(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', static::class, $beta)) extends \InvalidArgumentException implements InvalidArgumentException { }; } $item = $pool->getItem($key); From f64f59a9c0d92fdd65f9de3e44b612402b224aaf Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 4 Feb 2020 10:47:34 +0100 Subject: [PATCH 033/130] Fix CS --- .../DeprecationErrorHandler/Deprecation.php | 2 +- src/Symfony/Bridge/Twig/Node/DumpNode.php | 3 --- .../TranslationDefaultDomainNodeVisitor.php | 2 -- .../NodeVisitor/TranslationNodeVisitor.php | 2 -- .../Debug/WrappedLazyListener.php | 1 - .../Tests/Functional/Bundle/TestBundle.php | 1 - .../Compiler/ExtensionPass.php | 1 - .../Component/Cache/Adapter/PdoAdapter.php | 2 +- .../Component/Console/Command/Command.php | 2 +- .../DependencyInjection/Loader/FileLoader.php | 2 +- .../Loader/IniFileLoader.php | 2 +- .../Fragment/HIncludeFragmentRenderer.php | 3 --- .../Transport/AbstractTransportFactory.php | 1 - .../Component/Security/Http/Firewall.php | 1 - .../Tests/Firewall/ContextListenerTest.php | 5 ++-- .../Component/String/AbstractString.php | 24 +++++++++---------- .../String/AbstractUnicodeString.php | 6 ++--- src/Symfony/Component/String/ByteString.php | 4 ++-- .../Constraints/ExpressionValidatorTest.php | 1 - .../LazyLoadingMetadataFactoryTest.php | 1 - .../VarDumper/Test/VarDumperTestTrait.php | 3 --- .../VarExporter/Internal/Exporter.php | 2 -- 22 files changed, 25 insertions(+), 46 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php index 6263267fefe18..eef3f62a0634c 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php @@ -247,7 +247,7 @@ private static function getVendors() foreach (get_declared_classes() as $class) { if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { $r = new \ReflectionClass($class); - $v = \dirname(\dirname($r->getFileName())); + $v = \dirname($r->getFileName(), 2); if (file_exists($v.'/composer/installed.json')) { self::$vendors[] = $v; $loader = require $v.'/autoload.php'; diff --git a/src/Symfony/Bridge/Twig/Node/DumpNode.php b/src/Symfony/Bridge/Twig/Node/DumpNode.php index e94f1b7189f69..16718e8a75986 100644 --- a/src/Symfony/Bridge/Twig/Node/DumpNode.php +++ b/src/Symfony/Bridge/Twig/Node/DumpNode.php @@ -32,9 +32,6 @@ public function __construct($varPrefix, ?Node $values, int $lineno, string $tag $this->varPrefix = $varPrefix; } - /** - * @return void - */ public function compile(Compiler $compiler): void { $compiler diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php index d8a791b3a40b8..55bc3ae9a8959 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php @@ -107,8 +107,6 @@ protected function doLeaveNode(Node $node, Environment $env): ?Node /** * {@inheritdoc} - * - * @return int */ public function getPriority(): int { diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php index 2764afc0a402c..89a15cd622c5d 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php @@ -97,8 +97,6 @@ protected function doLeaveNode(Node $node, Environment $env): ?Node /** * {@inheritdoc} - * - * @return int */ public function getPriority(): int { diff --git a/src/Symfony/Bundle/SecurityBundle/Debug/WrappedLazyListener.php b/src/Symfony/Bundle/SecurityBundle/Debug/WrappedLazyListener.php index 67b178f3f6927..8e06d6ed1eeb0 100644 --- a/src/Symfony/Bundle/SecurityBundle/Debug/WrappedLazyListener.php +++ b/src/Symfony/Bundle/SecurityBundle/Debug/WrappedLazyListener.php @@ -15,7 +15,6 @@ use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\Security\Core\Exception\LazyResponseException; use Symfony\Component\Security\Http\Firewall\AbstractListener; -use Symfony\Component\VarDumper\Caster\ClassStub; /** * Wraps a lazy security listener. diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/TestBundle.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/TestBundle.php index d302b63791076..8336dce245792 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/TestBundle.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/TestBundle.php @@ -12,7 +12,6 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle; use Symfony\Component\DependencyInjection\Compiler\CheckTypeDeclarationsPass; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php index 062d843cd0a73..6c955aae6fa50 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php @@ -11,7 +11,6 @@ namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler; -use Symfony\Bridge\Twig\Extension\AssetExtension; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php index a7b6780acd457..99a671516af6f 100644 --- a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php @@ -427,7 +427,7 @@ private function getConnection(): object } else { switch ($this->driver = $this->conn->getDriver()->getName()) { case 'mysqli': - throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', \get_class($this))); + throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class)); case 'pdo_mysql': case 'drizzle_pdo_mysql': $this->driver = 'mysql'; diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index cfb29a2a6fe93..07da4a9223c70 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -255,7 +255,7 @@ public function run(InputInterface $input, OutputInterface $output) $statusCode = $this->execute($input, $output); if (!\is_int($statusCode)) { - throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, %s returned.', \get_class($this), \gettype($statusCode))); + throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, %s returned.', static::class, \gettype($statusCode))); } } diff --git a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php index 26577c9ef881a..eff0866e50247 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php @@ -57,7 +57,7 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe if ($ignoreNotFound = 'not_found' === $ignoreErrors) { $args[2] = false; } elseif (!\is_bool($ignoreErrors)) { - throw new \TypeError(sprintf('Invalid argument $ignoreErrors provided to %s::import(): boolean or "not_found" expected, %s given.', \get_class($this), \gettype($ignoreErrors))); + throw new \TypeError(sprintf('Invalid argument $ignoreErrors provided to %s::import(): boolean or "not_found" expected, %s given.', static::class, \gettype($ignoreErrors))); } try { diff --git a/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php index 8ed1e4277870a..e6384803c36ea 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php @@ -49,7 +49,7 @@ public function load($resource, string $type = null) /** * {@inheritdoc} */ - public function supports($resource, string $type = null) + public function supports($resource, string $type = null) { if (!\is_string($resource)) { return false; diff --git a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php index 9db6557663c8e..618859d0f9e0b 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php @@ -16,9 +16,6 @@ use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpKernel\UriSigner; use Twig\Environment; -use Twig\Error\LoaderError; -use Twig\Loader\ExistsLoaderInterface; -use Twig\Loader\SourceContextLoaderInterface; /** * Implements the Hinclude rendering strategy. diff --git a/src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php b/src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php index 2b0cae4b20c11..98e97be5f8bb8 100644 --- a/src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php +++ b/src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php @@ -18,7 +18,6 @@ /** * @author Konstantin Myakshin - * * @author Fabien Potencier * * @experimental in 5.0 diff --git a/src/Symfony/Component/Security/Http/Firewall.php b/src/Symfony/Component/Security/Http/Firewall.php index 7ccccdb623759..b239911b8b677 100644 --- a/src/Symfony/Component/Security/Http/Firewall.php +++ b/src/Symfony/Component/Security/Http/Firewall.php @@ -15,7 +15,6 @@ use Symfony\Component\HttpKernel\Event\FinishRequestEvent; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Security\Http\Firewall\AbstractListener; use Symfony\Component\Security\Http\Firewall\AccessListener; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php index 187058f5143c6..6eef7455793a7 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php @@ -399,8 +399,9 @@ private function handleEventWithPreviousSession($userProviders, UserInterface $u $tokenStorage = new TokenStorage(); $usageIndex = $session->getUsageIndex(); - $tokenStorage = new UsageTrackingTokenStorage($tokenStorage, new class([ - 'session' => function () use ($session) { return $session; } + $tokenStorage = new UsageTrackingTokenStorage($tokenStorage, new class(['session' => function () use ($session) { + return $session; + }, ]) implements ContainerInterface { use ServiceLocatorTrait; }); diff --git a/src/Symfony/Component/String/AbstractString.php b/src/Symfony/Component/String/AbstractString.php index e56697e391549..73daa1d495c06 100644 --- a/src/Symfony/Component/String/AbstractString.php +++ b/src/Symfony/Component/String/AbstractString.php @@ -31,15 +31,15 @@ */ abstract class AbstractString implements \JsonSerializable { - public const PREG_PATTERN_ORDER = \PREG_PATTERN_ORDER; - public const PREG_SET_ORDER = \PREG_SET_ORDER; - public const PREG_OFFSET_CAPTURE = \PREG_OFFSET_CAPTURE; - public const PREG_UNMATCHED_AS_NULL = \PREG_UNMATCHED_AS_NULL; + public const PREG_PATTERN_ORDER = PREG_PATTERN_ORDER; + public const PREG_SET_ORDER = PREG_SET_ORDER; + public const PREG_OFFSET_CAPTURE = PREG_OFFSET_CAPTURE; + public const PREG_UNMATCHED_AS_NULL = PREG_UNMATCHED_AS_NULL; public const PREG_SPLIT = 0; - public const PREG_SPLIT_NO_EMPTY = \PREG_SPLIT_NO_EMPTY; - public const PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE; - public const PREG_SPLIT_OFFSET_CAPTURE = \PREG_SPLIT_OFFSET_CAPTURE; + public const PREG_SPLIT_NO_EMPTY = PREG_SPLIT_NO_EMPTY; + public const PREG_SPLIT_DELIM_CAPTURE = PREG_SPLIT_DELIM_CAPTURE; + public const PREG_SPLIT_OFFSET_CAPTURE = PREG_SPLIT_OFFSET_CAPTURE; protected $string = ''; protected $ignoreCase = false; @@ -262,7 +262,7 @@ public function collapseWhitespace(): self public function endsWith($suffix): bool { if (!\is_array($suffix) && !$suffix instanceof \Traversable) { - throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, \get_class($this))); + throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); } foreach ($suffix as $s) { @@ -317,7 +317,7 @@ public function ensureStart(string $prefix): self public function equalsTo($string): bool { if (!\is_array($string) && !$string instanceof \Traversable) { - throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, \get_class($this))); + throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); } foreach ($string as $s) { @@ -351,7 +351,7 @@ public function ignoreCase(): self public function indexOf($needle, int $offset = 0): ?int { if (!\is_array($needle) && !$needle instanceof \Traversable) { - throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, \get_class($this))); + throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); } $i = \PHP_INT_MAX; @@ -373,7 +373,7 @@ public function indexOf($needle, int $offset = 0): ?int public function indexOfLast($needle, int $offset = 0): ?int { if (!\is_array($needle) && !$needle instanceof \Traversable) { - throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, \get_class($this))); + throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); } $i = null; @@ -536,7 +536,7 @@ public function split(string $delimiter, int $limit = null, int $flags = null): public function startsWith($prefix): bool { if (!\is_array($prefix) && !$prefix instanceof \Traversable) { - throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, \get_class($this))); + throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); } foreach ($prefix as $prefix) { diff --git a/src/Symfony/Component/String/AbstractUnicodeString.php b/src/Symfony/Component/String/AbstractUnicodeString.php index bc3e05cd6f10c..1e1b9d7de6e95 100644 --- a/src/Symfony/Component/String/AbstractUnicodeString.php +++ b/src/Symfony/Component/String/AbstractUnicodeString.php @@ -139,7 +139,7 @@ public function ascii(array $rules = []): self } } elseif (!\function_exists('iconv')) { $s = preg_replace('/[^\x00-\x7F]/u', '?', $s); - } elseif (\ICONV_IMPL === 'glibc') { + } elseif (ICONV_IMPL === 'glibc') { $s = iconv('UTF-8', 'ASCII//TRANSLIT', $s); } else { $s = preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) { @@ -223,7 +223,7 @@ public function lower(): parent public function match(string $regexp, int $flags = 0, int $offset = 0): array { - $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match'; + $match = ((PREG_PATTERN_ORDER | PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match'; if ($this->ignoreCase) { $regexp .= 'i'; @@ -309,7 +309,7 @@ public function replaceMatches(string $fromRegexp, $to): parent if (\is_array($to) || $to instanceof \Closure) { if (!\is_callable($to)) { - throw new \TypeError(sprintf('Argument 2 passed to %s::replaceMatches() must be callable, array given.', \get_class($this))); + throw new \TypeError(sprintf('Argument 2 passed to %s::replaceMatches() must be callable, array given.', static::class)); } $replace = 'preg_replace_callback'; diff --git a/src/Symfony/Component/String/ByteString.php b/src/Symfony/Component/String/ByteString.php index d831940e16b07..b1bb82ec222df 100644 --- a/src/Symfony/Component/String/ByteString.php +++ b/src/Symfony/Component/String/ByteString.php @@ -193,7 +193,7 @@ public function lower(): parent public function match(string $regexp, int $flags = 0, int $offset = 0): array { - $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match'; + $match = ((PREG_PATTERN_ORDER | PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match'; if ($this->ignoreCase) { $regexp .= 'i'; @@ -271,7 +271,7 @@ public function replaceMatches(string $fromRegexp, $to): parent if (\is_array($to)) { if (!\is_callable($to)) { - throw new \TypeError(sprintf('Argument 2 passed to %s::replaceMatches() must be callable, array given.', \get_class($this))); + throw new \TypeError(sprintf('Argument 2 passed to %s::replaceMatches() must be callable, array given.', static::class)); } $replace = 'preg_replace_callback'; diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php index 34d280b5da55c..280757b8e935f 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Validator\Tests\Constraints; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\Validator\Constraints\Expression; use Symfony\Component\Validator\Constraints\ExpressionValidator; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php index 6eb82b7585b6f..2cda5c6310b21 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php @@ -15,7 +15,6 @@ use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Validator\Constraints\Callback; -use Symfony\Component\Validator\Mapping\Cache\Psr6Cache; use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; diff --git a/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php b/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php index 258419c8f3c9a..33d60c020196b 100644 --- a/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php +++ b/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php @@ -52,9 +52,6 @@ public function assertDumpMatchesFormat($expected, $data, int $filter = 0, strin $this->assertStringMatchesFormat($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message); } - /** - * @return string|null - */ protected function getDump($data, $key = null, int $filter = 0): ?string { if (null === $flags = $this->varDumperConfig['flags']) { diff --git a/src/Symfony/Component/VarExporter/Internal/Exporter.php b/src/Symfony/Component/VarExporter/Internal/Exporter.php index 4d83a4b094dba..776f3bb38049e 100644 --- a/src/Symfony/Component/VarExporter/Internal/Exporter.php +++ b/src/Symfony/Component/VarExporter/Internal/Exporter.php @@ -31,8 +31,6 @@ class Exporter * @param int &$objectsCount * @param bool &$valuesAreStatic * - * @return array - * * @throws NotInstantiableTypeException When a value cannot be serialized */ public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount, &$valuesAreStatic): array From 629d21b800a15dc649fb0ae9ed7cd9211e7e45db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Tue, 4 Feb 2020 10:49:52 +0100 Subject: [PATCH 034/130] Escape variable in Exception Template --- .../ErrorHandler/Resources/views/traces_text.html.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/ErrorHandler/Resources/views/traces_text.html.php b/src/Symfony/Component/ErrorHandler/Resources/views/traces_text.html.php index e178fe0fcd413..a7090fbe8909e 100644 --- a/src/Symfony/Component/ErrorHandler/Resources/views/traces_text.html.php +++ b/src/Symfony/Component/ErrorHandler/Resources/views/traces_text.html.php @@ -20,15 +20,15 @@
 escape($exception['class']).":\n";
                     if ($exception['message']) {
-                        echo $exception['message']."\n";
+                        echo $this->escape($exception['message'])."\n";
                     }
 
                     foreach ($exception['trace'] as $trace) {
                         echo "\n  ";
                         if ($trace['function']) {
-                            echo 'at '.$trace['class'].$trace['type'].$trace['function'].'('.(isset($trace['args']) ? $this->formatArgsAsText($trace['args']) : '').')';
+                            echo $this->escape('at '.$trace['class'].$trace['type'].$trace['function']).'('.(isset($trace['args']) ? $this->formatArgsAsText($trace['args']) : '').')';
                         }
                         if ($trace['file'] && $trace['line']) {
                             echo($trace['function'] ? "\n     (" : 'at ').strtr(strip_tags($this->formatFile($trace['file'], $trace['line'])), [' at line '.$trace['line'] => '']).':'.$trace['line'].($trace['function'] ? ')' : '');

From c2e0aab7bee49e896aaad62871a0389fd4d34d06 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 4 Feb 2020 10:59:34 +0100
Subject: [PATCH 035/130] cs fix

---
 .../FrameworkBundle/Tests/Translation/TranslatorTest.php | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
index e38e11601b66e..9cb6046fa9631 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
@@ -16,6 +16,7 @@
 use Symfony\Bundle\FrameworkBundle\Translation\Translator;
 use Symfony\Component\Filesystem\Filesystem;
 use Symfony\Component\Translation\Formatter\MessageFormatter;
+use Symfony\Component\Translation\Loader\YamlFileLoader;
 use Symfony\Component\Translation\MessageCatalogue;
 
 class TranslatorTest extends TestCase
@@ -123,7 +124,7 @@ public function testTransWithCachingWithInvalidLocaleOmittingLocale()
      */
     public function testLoadResourcesWithoutCachingOmittingLocale()
     {
-        $loader = new \Symfony\Component\Translation\Loader\YamlFileLoader();
+        $loader = new YamlFileLoader();
         $resourceFiles = [
             'fr' => [
                 __DIR__.'/../Fixtures/Resources/translations/messages.fr.yml',
@@ -171,7 +172,7 @@ public function testGetDefaultLocaleOmittingLocaleWithPsrContainer()
      */
     public function testWarmupOmittingLocale()
     {
-        $loader = new \Symfony\Component\Translation\Loader\YamlFileLoader();
+        $loader = new YamlFileLoader();
         $resourceFiles = [
             'fr' => [
                 __DIR__.'/../Fixtures/Resources/translations/messages.fr.yml',
@@ -259,7 +260,7 @@ public function testTransWithCachingWithInvalidLocale()
 
     public function testLoadResourcesWithoutCaching()
     {
-        $loader = new \Symfony\Component\Translation\Loader\YamlFileLoader();
+        $loader = new YamlFileLoader();
         $resourceFiles = [
             'fr' => [
                 __DIR__.'/../Fixtures/Resources/translations/messages.fr.yml',
@@ -436,7 +437,7 @@ public function getTranslator($loader, $options = [], $loaderFomat = 'loader', $
 
     public function testWarmup()
     {
-        $loader = new \Symfony\Component\Translation\Loader\YamlFileLoader();
+        $loader = new YamlFileLoader();
         $resourceFiles = [
             'fr' => [
                 __DIR__.'/../Fixtures/Resources/translations/messages.fr.yml',

From a196d0571d57821acfe33be032947a64d86e795c Mon Sep 17 00:00:00 2001
From: Fabien Potencier 
Date: Tue, 4 Feb 2020 11:03:41 +0100
Subject: [PATCH 036/130] Fix bad merge

---
 .../Serializer/Normalizer/AbstractNormalizer.php       | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
index f4077d6611b6a..13387e2bc818f 100644
--- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
@@ -208,17 +208,7 @@ protected function isCircularReference(object $object, array &$context)
      */
     protected function handleCircularReference(object $object, string $format = null, array $context = [])
     {
-<<<<<<< HEAD
         $circularReferenceHandler = $context[self::CIRCULAR_REFERENCE_HANDLER] ?? $this->defaultContext[self::CIRCULAR_REFERENCE_HANDLER];
-=======
-        if (\func_num_args() < 2 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
-            @trigger_error(sprintf('The "%s()" method will have two new "string $format = null" and "array $context = []" arguments in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
-        }
-        $format = \func_num_args() > 1 ? func_get_arg(1) : null;
-        $context = \func_num_args() > 2 ? func_get_arg(2) : [];
-
-        $circularReferenceHandler = $context[self::CIRCULAR_REFERENCE_HANDLER] ?? $this->defaultContext[self::CIRCULAR_REFERENCE_HANDLER] ?? $this->circularReferenceHandler;
->>>>>>> 4.4
         if ($circularReferenceHandler) {
             return $circularReferenceHandler($object, $format, $context);
         }

From 056d59824fed657747c1e634d4bea691a23156e4 Mon Sep 17 00:00:00 2001
From: Laurent VOULLEMIER 
Date: Mon, 6 May 2019 19:12:13 +0200
Subject: [PATCH 037/130] [PhpUnitBridge] Fix some errors when using serialized
 deprecations

---
 .../PhpUnit/DeprecationErrorHandler.php       |  14 +-
 .../DeprecationErrorHandler/Deprecation.php   |  31 +++-
 .../DeprecationTest.php                       | 145 +++++++++++++++++-
 3 files changed, 180 insertions(+), 10 deletions(-)

diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
index 1519fb2bbf184..84a2f464c5d99 100644
--- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
@@ -104,7 +104,19 @@ public static function collectDeprecations($outputFile)
                 return \call_user_func(self::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
             }
 
-            $deprecations[] = [error_reporting(), $msg, $file];
+            $trace = debug_backtrace();
+            $filesStack = [];
+            foreach ($trace as $line) {
+                if (\in_array($line['function'], ['require', 'require_once', 'include', 'include_once'], true)) {
+                    continue;
+                }
+
+                if (isset($line['file'])) {
+                    $filesStack[] = $line['file'];
+                }
+            }
+
+            $deprecations[] = [error_reporting(), $msg, $file, $filesStack];
 
             return null;
         });
diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
index 6263267fefe18..55909ee6cf3af 100644
--- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
+++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
@@ -44,6 +44,8 @@ class Deprecation
      */
     private static $internalPaths = [];
 
+    private $originalFilesStack;
+
     /**
      * @param string $message
      * @param string $file
@@ -64,6 +66,7 @@ public function __construct($message, array $trace, $file)
                 $this->message = $parsedMsg['deprecation'];
                 $this->originClass = $parsedMsg['class'];
                 $this->originMethod = $parsedMsg['method'];
+                $this->originalFilesStack = $parsedMsg['files_stack'];
                 // If the deprecation has been triggered via
                 // \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest()
                 // then we need to use the serialized information to determine
@@ -162,6 +165,24 @@ public function isMuted()
         return false !== strpos($this->triggeringFile, \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'phpunit'.\DIRECTORY_SEPARATOR);
     }
 
+    private function getOriginalFilesStack(): array
+    {
+        if (null === $this->originalFilesStack) {
+            $this->originalFilesStack = [];
+            foreach ($this->trace as $line) {
+                if (\in_array($line['function'], ['require', 'require_once', 'include', 'include_once'], true)) {
+                    continue;
+                }
+                if (!isset($line['file'])) {
+                    continue;
+                }
+                $this->originalFilesStack[] = $line['file'];
+            }
+        }
+
+        return $this->originalFilesStack;
+    }
+
     /**
      * Tells whether both the calling package and the called package are vendor
      * packages.
@@ -178,14 +199,8 @@ public function getType()
             return self::TYPE_UNDETERMINED;
         }
         $erroringFile = $erroringPackage = null;
-        foreach ($this->trace as $line) {
-            if (\in_array($line['function'], ['require', 'require_once', 'include', 'include_once'], true)) {
-                continue;
-            }
-            if (!isset($line['file'])) {
-                continue;
-            }
-            $file = $line['file'];
+
+        foreach ($this->getOriginalFilesStack() as $file) {
             if ('-' === $file || 'Standard input code' === $file || !realpath($file)) {
                 continue;
             }
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
index d59b2d93372d3..af3f688d5d2d0 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
@@ -11,12 +11,32 @@
 
 namespace Symfony\Bridge\PhpUnit\Tests\DeprecationErrorHandler;
 
+use Composer\Autoload\ClassLoader;
 use PHPUnit\Framework\TestCase;
 use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
 use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation;
+use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV5;
 
 class DeprecationTest extends TestCase
 {
+    public static function setUpBeforeClass(): void
+    {
+        $vendorDir = self::getVendorDir();
+
+        mkdir($vendorDir.'/myfakevendor/myfakepackage1', 0777, true);
+        mkdir($vendorDir.'/myfakevendor/myfakepackage2');
+        touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile1.php');
+        touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile2.php');
+        touch($vendorDir.'/myfakevendor/myfakepackage2/MyFakeFile.php');
+    }
+
+    private static function getVendorDir(): string
+    {
+        $reflection = new \ReflectionClass(ClassLoader::class);
+
+        return \dirname($reflection->getFileName(), 2);
+    }
+
     public function testItCanDetermineTheClassWhereTheDeprecationHappened()
     {
         $deprecation = new Deprecation('💩', $this->debugBacktrace(), __FILE__);
@@ -118,12 +138,135 @@ public function testItTakesMutesDeprecationFromPhpUnitFiles()
         $this->assertTrue($deprecation->isMuted());
     }
 
+    public function providerGetTypeDetectsSelf(): array
+    {
+        foreach (get_declared_classes() as $class) {
+            if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
+                $r = new \ReflectionClass($class);
+                $v = \dirname(\dirname($r->getFileName()));
+                if (file_exists($v.'/composer/installed.json')) {
+                    $loader = require $v.'/autoload.php';
+                    $reflection = new \ReflectionClass($loader);
+                    $prop = $reflection->getProperty('prefixDirsPsr4');
+                    $prop->setAccessible(true);
+                    $currentValue = $prop->getValue($loader);
+                    $currentValue['Symfony\\Bridge\\PhpUnit\\'] = [realpath(__DIR__.'/../..')];
+                    $prop->setValue($loader, $currentValue);
+                }
+            }
+        }
+
+        return [
+            'not_from_vendors_file' => [Deprecation::TYPE_SELF, '', 'MyClass1', ''],
+            'nonexistent_file' => [Deprecation::TYPE_UNDETERMINED, '', 'MyClass1', 'dummy_vendor_path'],
+            'serialized_trace_with_nonexistent_triggering_file' => [
+                Deprecation::TYPE_UNDETERMINED,
+                serialize([
+                    'class' => '',
+                    'method' => '',
+                    'deprecation' => '',
+                    'triggering_file' => 'dummy_vendor_path',
+                    'files_stack' => [],
+                ]),
+                SymfonyTestsListenerForV5::class,
+                '',
+            ],
+        ];
+    }
+
+    /**
+     * @dataProvider providerGetTypeDetectsSelf
+     */
+    public function testGetTypeDetectsSelf(string $expectedType, string $message, string $traceClass, string $file): void
+    {
+        $trace = [
+            ['class' => 'MyClass1', 'function' => 'myMethod'],
+            ['class' => $traceClass, 'function' => 'myMethod'],
+        ];
+        $deprecation = new Deprecation($message, $trace, $file);
+        $this->assertEquals($expectedType, $deprecation->getType());
+    }
+
+    public function providerGetTypeUsesRightTrace(): array
+    {
+        $vendorDir = self::getVendorDir();
+
+        return [
+            'no_file_in_stack' => [Deprecation::TYPE_DIRECT, '', [['function' => 'myfunc1'], ['function' => 'myfunc2']]],
+            'files_in_stack_from_various_packages' => [
+                Deprecation::TYPE_INDIRECT,
+                '',
+                [
+                    ['function' => 'myfunc1', 'file' => $vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile1.php'],
+                    ['function' => 'myfunc2', 'file' => $vendorDir.'/myfakevendor/myfakepackage2/MyFakeFile.php'],
+                ],
+            ],
+            'serialized_stack_files_from_same_package' => [
+                Deprecation::TYPE_DIRECT,
+                serialize([
+                    'deprecation' => 'My deprecation message',
+                    'class' => 'MyClass',
+                    'method' => 'myMethod',
+                    'files_stack' => [
+                        $vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile1.php',
+                        $vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile2.php',
+                    ],
+                ]),
+                [['function' => 'myfunc1'], ['class' => SymfonyTestsListenerForV5::class, 'method' => 'mymethod']],
+            ],
+            'serialized_stack_files_from_various_packages' => [
+                Deprecation::TYPE_INDIRECT,
+                serialize([
+                    'deprecation' => 'My deprecation message',
+                    'class' => 'MyClass',
+                    'method' => 'myMethod',
+                    'files_stack' => [
+                        $vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile1.php',
+                        $vendorDir.'/myfakevendor/myfakepackage2/MyFakeFile.php',
+                    ],
+                ]),
+                [['function' => 'myfunc1'], ['class' => SymfonyTestsListenerForV5::class, 'method' => 'mymethod']],
+            ],
+        ];
+    }
+
+    /**
+     * @dataProvider providerGetTypeUsesRightTrace
+     */
+    public function testGetTypeUsesRightTrace(string $expectedType, string $message, array $trace): void
+    {
+        $deprecation = new Deprecation(
+            $message,
+            $trace,
+            self::getVendorDir().'/myfakevendor/myfakepackage2/MyFakeFile.php'
+        );
+        $this->assertEquals($expectedType, $deprecation->getType());
+    }
+
     /**
      * This method is here to simulate the extra level from the piece of code
-     * triggering an error to the error handler
+     * triggering an error to the error handler.
      */
     public function debugBacktrace(): array
     {
         return debug_backtrace();
     }
+
+    private static function removeDir($dir): void
+    {
+        $files = glob($dir.'/*');
+        foreach ($files as $file) {
+            if (is_file($file)) {
+                unlink($file);
+            } else {
+                self::removeDir($file);
+            }
+        }
+        rmdir($dir);
+    }
+
+    public static function tearDownAfterClass(): void
+    {
+        self::removeDir(self::getVendorDir().'/myfakevendor');
+    }
 }

From 6fc91eb192736f19729a1bb9fa0bd905b42f0a61 Mon Sep 17 00:00:00 2001
From: Alexandre Parent 
Date: Tue, 14 Jan 2020 14:11:45 -0500
Subject: [PATCH 038/130] [DI] Fix support for multiple tags for locators and
 iterators

---
 .../Compiler/PriorityTaggedServiceTrait.php   | 119 +++++++++---------
 .../Tests/Compiler/IntegrationTest.php        |  64 +++++++++-
 2 files changed, 123 insertions(+), 60 deletions(-)

diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php
index 9b3760b49758d..1a2c829854dc6 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php
@@ -54,78 +54,81 @@ private function findAndSortTaggedServices($tagName, ContainerBuilder $container
 
         foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $attributes) {
             $class = $r = null;
-            $priority = 0;
-            if (isset($attributes[0]['priority'])) {
-                $priority = $attributes[0]['priority'];
-            } elseif ($defaultPriorityMethod) {
-                $class = $container->getDefinition($serviceId)->getClass();
-                $class = $container->getParameterBag()->resolveValue($class) ?: null;
-
-                if (($r = $container->getReflectionClass($class)) && $r->hasMethod($defaultPriorityMethod)) {
-                    if (!($rm = $r->getMethod($defaultPriorityMethod))->isStatic()) {
-                        throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be static: tag "%s" on service "%s".', $class, $defaultPriorityMethod, $tagName, $serviceId));
-                    }
-
-                    if (!$rm->isPublic()) {
-                        throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be public: tag "%s" on service "%s".', $class, $defaultPriorityMethod, $tagName, $serviceId));
-                    }
-
-                    $priority = $rm->invoke(null);
-
-                    if (!\is_int($priority)) {
-                        throw new InvalidArgumentException(sprintf('Method "%s::%s()" should return an integer, got %s: tag "%s" on service "%s".', $class, $defaultPriorityMethod, \gettype($priority), $tagName, $serviceId));
-                    }
-                }
-            }
-
-            if (null === $indexAttribute && !$needsIndexes) {
-                $services[$priority][] = new Reference($serviceId);
-
-                continue;
-            }
 
-            if (!$class) {
-                $class = $container->getDefinition($serviceId)->getClass();
-                $class = $container->getParameterBag()->resolveValue($class) ?: null;
-            }
+            $defaultPriority = null;
+            $defaultIndex = null;
 
-            if (null !== $indexAttribute && isset($attributes[0][$indexAttribute])) {
-                $services[$priority][$attributes[0][$indexAttribute]] = new TypedReference($serviceId, $class, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, $attributes[0][$indexAttribute]);
+            foreach ($attributes as $attribute) {
+                $index = $priority = null;
 
-                continue;
-            }
+                if (isset($attribute['priority'])) {
+                    $priority = $attribute['priority'];
+                } elseif (null === $defaultPriority && $defaultPriorityMethod) {
+                    $class = $container->getDefinition($serviceId)->getClass();
+                    $class = $container->getParameterBag()->resolveValue($class) ?: null;
 
-            if (!$r && !$r = $container->getReflectionClass($class)) {
-                throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $serviceId));
-            }
+                    if (($r = ($r ?? $container->getReflectionClass($class))) && $r->hasMethod($defaultPriorityMethod)) {
+                        if (!($rm = $r->getMethod($defaultPriorityMethod))->isStatic()) {
+                            throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be static: tag "%s" on service "%s".', $class, $defaultPriorityMethod, $tagName, $serviceId));
+                        }
 
-            $class = $r->name;
+                        if (!$rm->isPublic()) {
+                            throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be public: tag "%s" on service "%s".', $class, $defaultPriorityMethod, $tagName, $serviceId));
+                        }
 
-            if (!$r->hasMethod($defaultIndexMethod)) {
-                if ($needsIndexes) {
-                    $services[$priority][$serviceId] = new TypedReference($serviceId, $class);
+                        $defaultPriority = $rm->invoke(null);
 
-                    continue;
+                        if (!\is_int($defaultPriority)) {
+                            throw new InvalidArgumentException(sprintf('Method "%s::%s()" should return an integer, got %s: tag "%s" on service "%s".', $class, $defaultPriorityMethod, \gettype($priority), $tagName, $serviceId));
+                        }
+                    }
                 }
 
-                throw new InvalidArgumentException(sprintf('Method "%s::%s()" not found: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute));
-            }
+                $priority = $priority ?? $defaultPriority ?? 0;
+
+                if (null !== $indexAttribute && isset($attribute[$indexAttribute])) {
+                    $index = $attribute[$indexAttribute];
+                } elseif (null === $defaultIndex && null === $indexAttribute && !$needsIndexes) {
+                    // With partially associative array, insertion to get next key is simpler.
+                    $services[$priority][] = null;
+                    end($services[$priority]);
+                    $defaultIndex = key($services[$priority]);
+                } elseif (null === $defaultIndex && $defaultIndexMethod) {
+                    $class = $container->getDefinition($serviceId)->getClass();
+                    $class = $container->getParameterBag()->resolveValue($class) ?: null;
+
+                    if (($r = ($r ?? $container->getReflectionClass($class))) && $r->hasMethod($defaultIndexMethod)) {
+                        if (!($rm = $r->getMethod($defaultIndexMethod))->isStatic()) {
+                            throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be static: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute));
+                        }
+
+                        if (!$rm->isPublic()) {
+                            throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be public: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute));
+                        }
+
+                        $defaultIndex = $rm->invoke(null);
+
+                        if (!\is_string($defaultIndex)) {
+                            throw new InvalidArgumentException(sprintf('Method "%s::%s()" should return a string, got %s: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, \gettype($defaultIndex), $tagName, $serviceId, $indexAttribute));
+                        }
+                    }
 
-            if (!($rm = $r->getMethod($defaultIndexMethod))->isStatic()) {
-                throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be static: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute));
-            }
+                    $defaultIndex = $defaultIndex ?? $serviceId;
+                }
 
-            if (!$rm->isPublic()) {
-                throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be public: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute));
-            }
+                $index = $index ?? $defaultIndex;
 
-            $key = $rm->invoke(null);
+                $reference = null;
+                if (!$class || 'stdClass' === $class) {
+                    $reference = new Reference($serviceId);
+                } elseif ($index === $serviceId) {
+                    $reference = new TypedReference($serviceId, $class);
+                } else {
+                    $reference = new TypedReference($serviceId, $class, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, \is_string($index) ? $index : null);
+                }
 
-            if (!\is_string($key)) {
-                throw new InvalidArgumentException(sprintf('Method "%s::%s()" should return a string, got %s: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, \gettype($key), $tagName, $serviceId, $indexAttribute));
+                $services[$priority][$index] = $reference;
             }
-
-            $services[$priority][$key] = new TypedReference($serviceId, $class, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, $key);
         }
 
         if ($services) {
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php
index 6b088af2c96bd..26e50f484b0e1 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php
@@ -314,6 +314,32 @@ public function testTaggedServiceWithIndexAttributeAndDefaultMethod()
         $this->assertSame(['bar_tab_class_with_defaultmethod' => $container->get(BarTagClass::class), 'foo' => $container->get(FooTagClass::class)], $param);
     }
 
+    public function testTaggedIteratorWithMultipleIndexAttribute()
+    {
+        $container = new ContainerBuilder();
+        $container->register(BarTagClass::class)
+            ->setPublic(true)
+            ->addTag('foo_bar', ['foo' => 'bar'])
+            ->addTag('foo_bar', ['foo' => 'bar_duplicate'])
+        ;
+        $container->register(FooTagClass::class)
+            ->setPublic(true)
+            ->addTag('foo_bar')
+            ->addTag('foo_bar')
+        ;
+        $container->register(FooBarTaggedClass::class)
+            ->addArgument(new TaggedIteratorArgument('foo_bar', 'foo'))
+            ->setPublic(true)
+        ;
+
+        $container->compile();
+
+        $s = $container->get(FooBarTaggedClass::class);
+
+        $param = iterator_to_array($s->getParam()->getIterator());
+        $this->assertSame(['bar' => $container->get(BarTagClass::class), 'bar_duplicate' => $container->get(BarTagClass::class), 'foo_tag_class' => $container->get(FooTagClass::class)], $param);
+    }
+
     public function testTaggedServiceWithDefaultPriorityMethod()
     {
         $container = new ContainerBuilder();
@@ -350,7 +376,7 @@ public function testTaggedServiceLocatorWithIndexAttribute()
             ->addTag('foo_bar')
         ;
         $container->register('foo_bar_tagged', FooBarTaggedClass::class)
-            ->addArgument(new ServiceLocatorArgument(new TaggedIteratorArgument('foo_bar', 'foo')))
+            ->addArgument(new ServiceLocatorArgument(new TaggedIteratorArgument('foo_bar', 'foo', null, true)))
             ->setPublic(true)
         ;
 
@@ -369,6 +395,40 @@ public function testTaggedServiceLocatorWithIndexAttribute()
         $this->assertSame(['bar' => $container->get('bar_tag'), 'foo_tag_class' => $container->get('foo_tag')], $same);
     }
 
+    public function testTaggedServiceLocatorWithMultipleIndexAttribute()
+    {
+        $container = new ContainerBuilder();
+        $container->register('bar_tag', BarTagClass::class)
+            ->setPublic(true)
+            ->addTag('foo_bar', ['foo' => 'bar'])
+            ->addTag('foo_bar', ['foo' => 'bar_duplicate'])
+        ;
+        $container->register('foo_tag', FooTagClass::class)
+            ->setPublic(true)
+            ->addTag('foo_bar')
+            ->addTag('foo_bar')
+        ;
+        $container->register('foo_bar_tagged', FooBarTaggedClass::class)
+            ->addArgument(new ServiceLocatorArgument(new TaggedIteratorArgument('foo_bar', 'foo', null, true)))
+            ->setPublic(true)
+        ;
+
+        $container->compile();
+
+        $s = $container->get('foo_bar_tagged');
+
+        /** @var ServiceLocator $serviceLocator */
+        $serviceLocator = $s->getParam();
+        $this->assertTrue($s->getParam() instanceof ServiceLocator, sprintf('Wrong instance, should be an instance of ServiceLocator, %s given', \is_object($serviceLocator) ? \get_class($serviceLocator) : \gettype($serviceLocator)));
+
+        $same = [
+            'bar' => $serviceLocator->get('bar'),
+            'bar_duplicate' => $serviceLocator->get('bar_duplicate'),
+            'foo_tag_class' => $serviceLocator->get('foo_tag_class'),
+        ];
+        $this->assertSame(['bar' => $container->get('bar_tag'), 'bar_duplicate' => $container->get('bar_tag'), 'foo_tag_class' => $container->get('foo_tag')], $same);
+    }
+
     public function testTaggedServiceLocatorWithIndexAttributeAndDefaultMethod()
     {
         $container = new ContainerBuilder();
@@ -381,7 +441,7 @@ public function testTaggedServiceLocatorWithIndexAttributeAndDefaultMethod()
             ->addTag('foo_bar', ['foo' => 'foo'])
         ;
         $container->register('foo_bar_tagged', FooBarTaggedClass::class)
-            ->addArgument(new ServiceLocatorArgument(new TaggedIteratorArgument('foo_bar', 'foo', 'getFooBar')))
+            ->addArgument(new ServiceLocatorArgument(new TaggedIteratorArgument('foo_bar', 'foo', 'getFooBar', true)))
             ->setPublic(true)
         ;
 

From 550819a655aeea01495649845952b6ca9c3e898d Mon Sep 17 00:00:00 2001
From: Roland Franssen 
Date: Fri, 11 Oct 2019 21:04:41 +0200
Subject: [PATCH 039/130] [DI] Unknown env prefix not regornized as such

---
 .../DependencyInjection/EnvVarProcessor.php      | 16 ++++++++++------
 .../Tests/EnvVarProcessorTest.php                | 14 ++++++++++++++
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php
index 1b8b64cac357f..b7c828b124eb3 100644
--- a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php
+++ b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php
@@ -126,9 +126,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
         }
 
         if (false !== $i || 'string' !== $prefix) {
-            if (null === $env = $getEnv($name)) {
-                return null;
-            }
+            $env = $getEnv($name);
         } elseif (isset($_ENV[$name])) {
             $env = $_ENV[$name];
         } elseif (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) {
@@ -173,10 +171,16 @@ public function getEnv($prefix, $name, \Closure $getEnv)
                     throw new EnvNotFoundException(sprintf('Environment variable not found: "%s".', $name));
                 }
 
-                if (null === $env = $this->container->getParameter("env($name)")) {
-                    return null;
-                }
+                $env = $this->container->getParameter("env($name)");
+            }
+        }
+
+        if (null === $env) {
+            if (!isset($this->getProvidedTypes()[$prefix])) {
+                throw new RuntimeException(sprintf('Unsupported env var prefix "%s".', $prefix));
             }
+
+            return null;
         }
 
         if (!is_scalar($env)) {
diff --git a/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php b/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php
index df329b4f7e316..313bce597366f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php
@@ -9,6 +9,7 @@
 use Symfony\Component\DependencyInjection\EnvVarLoaderInterface;
 use Symfony\Component\DependencyInjection\EnvVarProcessor;
 use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException;
+use Symfony\Component\DependencyInjection\Exception\RuntimeException;
 
 class EnvVarProcessorTest extends TestCase
 {
@@ -595,4 +596,17 @@ public function loadEnvVars(): array
 
         $this->assertSame(2, $index);
     }
+
+    public function testGetEnvInvalidPrefixWithDefault()
+    {
+        $this->expectException(RuntimeException::class);
+        $this->expectExceptionMessage('Unsupported env var prefix');
+        $processor = new EnvVarProcessor(new Container());
+
+        $processor->getEnv('unknown', 'default::FAKE', function ($name) {
+            $this->assertSame('default::FAKE', $name);
+
+            return null;
+        });
+    }
 }

From 5ae1384e8fa59bc38aa7a82e3ff946ae0b77d586 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 4 Feb 2020 20:51:39 +0100
Subject: [PATCH 040/130] [Messenger] fix typo

---
 .../Mailer/Bridge/Mailchimp/Http/MandrillTransport.php          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php
index b6b3bef07e766..79201f7f8acb5 100644
--- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php
+++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php
@@ -16,7 +16,7 @@
 use Symfony\Component\Mailer\Exception\TransportException;
 use Symfony\Component\Mailer\SentMessage;
 use Symfony\Component\Mailer\SmtpEnvelope;
-use Symfony\Component\Mailer\Transport\Http\AbstractHttpTransport;
+use Symfony\Component\Mailer\Transport\AbstractHttpTransport;
 use Symfony\Component\Mime\Address;
 use Symfony\Contracts\HttpClient\HttpClientInterface;
 

From 88b45799421c4cddf1f6e170d68ff09c60c01d4e Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 4 Feb 2020 20:55:13 +0100
Subject: [PATCH 041/130] [Mailer] fix typos

---
 .../Tests/Transport/MandrillHttpTransportTest.php  |  2 +-
 .../Mailchimp/Transport/MandrillHttpTransport.php  | 14 +++-----------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php
index dd2851154e76d..cfdc30bb78e63 100644
--- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php
+++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php
@@ -57,7 +57,7 @@ public function testSend()
             $body = json_decode($options['body'], true);
             $message = $body['raw_message'];
             $this->assertSame('KEY', $body['key']);
-            $this->assertSame('Saif Eddin ', $body['to'][0]);
+            $this->assertSame('saif.gmati@symfony.com', $body['to'][0]);
             $this->assertSame('Fabien ', $body['from_email']);
 
             $this->assertStringContainsString('Subject: Hello!', $message);
diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php
index 09e728862c515..6ead15490671f 100644
--- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php
+++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php
@@ -47,7 +47,9 @@ protected function doSendHttp(SentMessage $message): ResponseInterface
         $response = $this->client->request('POST', 'https://'.$this->getEndpoint().'/api/1.0/messages/send-raw.json', [
             'json' => [
                 'key' => $this->key,
-                'to' => $this->getRecipients($envelope->getRecipients()),
+                'to' => array_map(function (Address $recipient): string {
+                    return $recipient->getAddress();
+                }, $envelope->getRecipients()),
                 'from_email' => $envelope->getSender()->toString(),
                 'raw_message' => $message->toString(),
             ],
@@ -71,14 +73,4 @@ private function getEndpoint(): ?string
     {
         return ($this->host ?: self::HOST).($this->port ? ':'.$this->port : '');
     }
-
-    /**
-     * @return string[]
-     */
-    private function getRecipients(Envelope $envelope): array
-    {
-        return array_map(function (Address $recipient): string {
-            return $recipient->getAddress();
-        }, $envelope->getRecipients());
-    }
 }

From abeee5f018614f5af13dfef33bfcf2180e84851f Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 4 Feb 2020 23:28:01 +0100
Subject: [PATCH 042/130] [Mailer] fix merge

---
 .../Mailchimp/Http/MandrillTransport.php      | 71 -------------------
 1 file changed, 71 deletions(-)
 delete mode 100644 src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php

diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php
deleted file mode 100644
index 79201f7f8acb5..0000000000000
--- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/MandrillTransport.php
+++ /dev/null
@@ -1,71 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Mailer\Bridge\Mailchimp\Http;
-
-use Psr\Log\LoggerInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\Mailer\Exception\TransportException;
-use Symfony\Component\Mailer\SentMessage;
-use Symfony\Component\Mailer\SmtpEnvelope;
-use Symfony\Component\Mailer\Transport\AbstractHttpTransport;
-use Symfony\Component\Mime\Address;
-use Symfony\Contracts\HttpClient\HttpClientInterface;
-
-/**
- * @author Kevin Verschaeve
- *
- * @experimental in 4.3
- */
-class MandrillTransport extends AbstractHttpTransport
-{
-    private const ENDPOINT = 'https://mandrillapp.com/api/1.0/messages/send-raw.json';
-    private $key;
-
-    public function __construct(string $key, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
-    {
-        $this->key = $key;
-
-        parent::__construct($client, $dispatcher, $logger);
-    }
-
-    protected function doSend(SentMessage $message): void
-    {
-        $envelope = $message->getEnvelope();
-        $response = $this->client->request('POST', self::ENDPOINT, [
-            'json' => [
-                'key' => $this->key,
-                'to' => $this->getRecipients($envelope),
-                'from_email' => $envelope->getSender()->getAddress(),
-                'raw_message' => $message->toString(),
-            ],
-        ]);
-
-        if (200 !== $response->getStatusCode()) {
-            $result = $response->toArray(false);
-            if ('error' === ($result['status'] ?? false)) {
-                throw new TransportException(sprintf('Unable to send an email: %s (code %s).', $result['message'], $result['code']));
-            }
-
-            throw new TransportException(sprintf('Unable to send an email (code %s).', $result['code']));
-        }
-    }
-
-    /**
-     * @return string[]
-     */
-    private function getRecipients(SmtpEnvelope $envelope): array
-    {
-        return array_map(function (Address $recipient): string {
-            return $recipient->getAddress();
-        }, $envelope->getRecipients());
-    }
-}

From d5302cb5d25138fada872719b244eeed5fcef85d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= 
Date: Wed, 5 Feb 2020 08:22:07 +0100
Subject: [PATCH 043/130] Provide current file as file path

---
 .../PhpUnit/DeprecationErrorHandler.php       |  9 ++---
 .../DeprecationErrorHandler/Deprecation.php   | 34 +++++++++----------
 .../DeprecationTest.php                       |  2 +-
 3 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
index 84a2f464c5d99..cbe405fa22bd0 100644
--- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
@@ -104,16 +104,13 @@ public static function collectDeprecations($outputFile)
                 return \call_user_func(self::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
             }
 
-            $trace = debug_backtrace();
             $filesStack = [];
-            foreach ($trace as $line) {
-                if (\in_array($line['function'], ['require', 'require_once', 'include', 'include_once'], true)) {
+            foreach (debug_backtrace() as $frame) {
+                if (!isset($frame['file']) || \in_array($frame['function'], ['require', 'require_once', 'include', 'include_once'], true)) {
                     continue;
                 }
 
-                if (isset($line['file'])) {
-                    $filesStack[] = $line['file'];
-                }
+                $filesStack[] = $frame['file'];
             }
 
             $deprecations[] = [error_reporting(), $msg, $file, $filesStack];
diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
index 55909ee6cf3af..af9b4a539faef 100644
--- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
+++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
@@ -165,24 +165,6 @@ public function isMuted()
         return false !== strpos($this->triggeringFile, \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'phpunit'.\DIRECTORY_SEPARATOR);
     }
 
-    private function getOriginalFilesStack(): array
-    {
-        if (null === $this->originalFilesStack) {
-            $this->originalFilesStack = [];
-            foreach ($this->trace as $line) {
-                if (\in_array($line['function'], ['require', 'require_once', 'include', 'include_once'], true)) {
-                    continue;
-                }
-                if (!isset($line['file'])) {
-                    continue;
-                }
-                $this->originalFilesStack[] = $line['file'];
-            }
-        }
-
-        return $this->originalFilesStack;
-    }
-
     /**
      * Tells whether both the calling package and the called package are vendor
      * packages.
@@ -224,6 +206,22 @@ public function getType()
         return self::TYPE_DIRECT;
     }
 
+    private function getOriginalFilesStack(): array
+    {
+        if (null === $this->originalFilesStack) {
+            $this->originalFilesStack = [];
+            foreach ($this->trace as $frame) {
+                if (!isset($frame['file']) || \in_array($frame['function'], ['require', 'require_once', 'include', 'include_once'], true)) {
+                    continue;
+                }
+
+                $this->originalFilesStack[] = $frame['file'];
+            }
+        }
+
+        return $this->originalFilesStack;
+    }
+
     /**
      * getPathType() should always be called prior to calling this method.
      *
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
index af3f688d5d2d0..d1faa0cad8509 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
@@ -157,7 +157,7 @@ public function providerGetTypeDetectsSelf(): array
         }
 
         return [
-            'not_from_vendors_file' => [Deprecation::TYPE_SELF, '', 'MyClass1', ''],
+            'not_from_vendors_file' => [Deprecation::TYPE_SELF, '', 'MyClass1', __FILE__],
             'nonexistent_file' => [Deprecation::TYPE_UNDETERMINED, '', 'MyClass1', 'dummy_vendor_path'],
             'serialized_trace_with_nonexistent_triggering_file' => [
                 Deprecation::TYPE_UNDETERMINED,

From 341dd5dd1dec50c1a0f5c2f24312088b8ee0a551 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Wed, 5 Feb 2020 11:18:03 +0100
Subject: [PATCH 044/130] [PhpUnitBridge] fix getting the vendor/ dir for tests

---
 .../DeprecationTest.php                       | 30 ++++++++++++-------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
index d1faa0cad8509..33b021c6012df 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
@@ -19,22 +19,32 @@
 
 class DeprecationTest extends TestCase
 {
-    public static function setUpBeforeClass(): void
+    private static $vendorDir;
+
+    private static function getVendorDir(): string
     {
-        $vendorDir = self::getVendorDir();
+        if (null !== self::$vendorDir) {
+            return self::$vendorDir;
+        }
+
+        foreach (get_declared_classes() as $class) {
+            if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
+                $r = new \ReflectionClass($class);
+                $vendorDir = \dirname(\dirname($r->getFileName()));
+                if (file_exists($vendorDir.'/composer/installed.json') && @mkdir($vendorDir.'/myfakevendor/myfakepackage1', 0777, true)) {
+                    break;
+                }
+            }
+        }
 
-        mkdir($vendorDir.'/myfakevendor/myfakepackage1', 0777, true);
+        self::$vendorDir = $vendorDir;
         mkdir($vendorDir.'/myfakevendor/myfakepackage2');
         touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile1.php');
         touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile2.php');
         touch($vendorDir.'/myfakevendor/myfakepackage2/MyFakeFile.php');
-    }
 
-    private static function getVendorDir(): string
-    {
-        $reflection = new \ReflectionClass(ClassLoader::class);
 
-        return \dirname($reflection->getFileName(), 2);
+        return self::$vendorDir;
     }
 
     public function testItCanDetermineTheClassWhereTheDeprecationHappened()
@@ -184,7 +194,7 @@ public function testGetTypeDetectsSelf(string $expectedType, string $message, st
             ['class' => $traceClass, 'function' => 'myMethod'],
         ];
         $deprecation = new Deprecation($message, $trace, $file);
-        $this->assertEquals($expectedType, $deprecation->getType());
+        $this->assertSame($expectedType, $deprecation->getType());
     }
 
     public function providerGetTypeUsesRightTrace(): array
@@ -240,7 +250,7 @@ public function testGetTypeUsesRightTrace(string $expectedType, string $message,
             $trace,
             self::getVendorDir().'/myfakevendor/myfakepackage2/MyFakeFile.php'
         );
-        $this->assertEquals($expectedType, $deprecation->getType());
+        $this->assertSame($expectedType, $deprecation->getType());
     }
 
     /**

From 73bc793be2bb58c936b3df34507ef7d8320abc72 Mon Sep 17 00:00:00 2001
From: Alan Poulain 
Date: Wed, 5 Feb 2020 17:32:02 +0100
Subject: [PATCH 045/130] Replace 403 with 401 in onAuthenticationFailure
 method

---
 .../Component/Security/Guard/GuardAuthenticatorInterface.php    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php
index 7372eb844a6d0..5701157e1cfa3 100644
--- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php
+++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php
@@ -107,7 +107,7 @@ public function createAuthenticatedToken(UserInterface $user, $providerKey);
      * Called when authentication executed, but failed (e.g. wrong username password).
      *
      * This should return the Response sent back to the user, like a
-     * RedirectResponse to the login page or a 403 response.
+     * RedirectResponse to the login page or a 401 response.
      *
      * If you return null, the request will continue, but the user will
      * not be authenticated. This is probably not what you want to do.

From c31ce63221f067af3d00895e6c4c108d31de2157 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Wed, 5 Feb 2020 19:22:16 +0100
Subject: [PATCH 046/130] [Bridge/PhpUnit] fix parse error on PHP5

---
 .../DeprecationErrorHandler/Deprecation.php      |  2 +-
 .../DeprecationErrorHandler/DeprecationTest.php  | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
index af9b4a539faef..f4e9a8ff97e1d 100644
--- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
+++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
@@ -206,7 +206,7 @@ public function getType()
         return self::TYPE_DIRECT;
     }
 
-    private function getOriginalFilesStack(): array
+    private function getOriginalFilesStack()
     {
         if (null === $this->originalFilesStack) {
             $this->originalFilesStack = [];
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
index 33b021c6012df..17638e458e462 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
@@ -21,7 +21,7 @@ class DeprecationTest extends TestCase
 {
     private static $vendorDir;
 
-    private static function getVendorDir(): string
+    private static function getVendorDir()
     {
         if (null !== self::$vendorDir) {
             return self::$vendorDir;
@@ -148,7 +148,7 @@ public function testItTakesMutesDeprecationFromPhpUnitFiles()
         $this->assertTrue($deprecation->isMuted());
     }
 
-    public function providerGetTypeDetectsSelf(): array
+    public function providerGetTypeDetectsSelf()
     {
         foreach (get_declared_classes() as $class) {
             if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
@@ -187,7 +187,7 @@ public function providerGetTypeDetectsSelf(): array
     /**
      * @dataProvider providerGetTypeDetectsSelf
      */
-    public function testGetTypeDetectsSelf(string $expectedType, string $message, string $traceClass, string $file): void
+    public function testGetTypeDetectsSelf(string $expectedType, string $message, string $traceClass, string $file)
     {
         $trace = [
             ['class' => 'MyClass1', 'function' => 'myMethod'],
@@ -197,7 +197,7 @@ public function testGetTypeDetectsSelf(string $expectedType, string $message, st
         $this->assertSame($expectedType, $deprecation->getType());
     }
 
-    public function providerGetTypeUsesRightTrace(): array
+    public function providerGetTypeUsesRightTrace()
     {
         $vendorDir = self::getVendorDir();
 
@@ -243,7 +243,7 @@ public function providerGetTypeUsesRightTrace(): array
     /**
      * @dataProvider providerGetTypeUsesRightTrace
      */
-    public function testGetTypeUsesRightTrace(string $expectedType, string $message, array $trace): void
+    public function testGetTypeUsesRightTrace(string $expectedType, string $message, array $trace)
     {
         $deprecation = new Deprecation(
             $message,
@@ -257,12 +257,12 @@ public function testGetTypeUsesRightTrace(string $expectedType, string $message,
      * This method is here to simulate the extra level from the piece of code
      * triggering an error to the error handler.
      */
-    public function debugBacktrace(): array
+    public function debugBacktrace()
     {
         return debug_backtrace();
     }
 
-    private static function removeDir($dir): void
+    private static function removeDir($dir)
     {
         $files = glob($dir.'/*');
         foreach ($files as $file) {
@@ -275,7 +275,7 @@ private static function removeDir($dir): void
         rmdir($dir);
     }
 
-    public static function tearDownAfterClass(): void
+    public static function tearDownAfterClass()
     {
         self::removeDir(self::getVendorDir().'/myfakevendor');
     }

From cacb503294b654d23a997643d7db586d05aca172 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Wed, 5 Feb 2020 19:46:15 +0100
Subject: [PATCH 047/130] [Bridge/PhpUnit] fix compat with recent versions of
 phpunit

---
 .../Tests/DeprecationErrorHandler/DeprecationTest.php        | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
index 17638e458e462..f4b418961c94b 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
@@ -16,9 +16,12 @@
 use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
 use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation;
 use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV5;
+use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
 
 class DeprecationTest extends TestCase
 {
+    use SetUpTearDownTrait;
+
     private static $vendorDir;
 
     private static function getVendorDir()
@@ -275,7 +278,7 @@ private static function removeDir($dir)
         rmdir($dir);
     }
 
-    public static function tearDownAfterClass()
+    private static function doTearDownAfterClass()
     {
         self::removeDir(self::getVendorDir().'/myfakevendor');
     }

From 9bb194098f6df090f4174096c1e9a86a903f9b87 Mon Sep 17 00:00:00 2001
From: Jules Pietri 
Date: Wed, 5 Feb 2020 19:53:27 +0100
Subject: [PATCH 048/130] [DoctrineBridge] Fixed submitting ids with query
 limit or offset

---
 .../Form/ChoiceList/ORMQueryBuilderLoader.php |  2 +-
 .../Tests/Form/Type/EntityTypeTest.php        | 27 ++++++++++++++++++-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
index 875b08dae95e0..9c1f779e5fcad 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
@@ -62,7 +62,7 @@ public function getEntitiesByIds($identifier, array $values)
             $metadata = $this->queryBuilder->getEntityManager()->getClassMetadata(current($this->queryBuilder->getRootEntities()));
 
             foreach ($this->getEntities() as $entity) {
-                if (\in_array(current($metadata->getIdentifierValues($entity)), $values, true)) {
+                if (\in_array((string) current($metadata->getIdentifierValues($entity)), $values, true)) {
                     $choices[] = $entity;
                 }
             }
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index bc12de5d427e9..7bb57d707ddd8 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -956,7 +956,32 @@ public function testDisallowChoicesThatAreNotIncludedQueryBuilderSingleIdentifie
         $this->assertNull($field->getData());
     }
 
-    public function testDisallowChoicesThatAreNotIncludedQueryBuilderSingleIdentifierWithLimit()
+    public function testSingleIdentifierWithLimit()
+    {
+        $entity1 = new SingleIntIdEntity(1, 'Foo');
+        $entity2 = new SingleIntIdEntity(2, 'Bar');
+        $entity3 = new SingleIntIdEntity(3, 'Baz');
+
+        $this->persist([$entity1, $entity2, $entity3]);
+
+        $repository = $this->em->getRepository(self::SINGLE_IDENT_CLASS);
+
+        $field = $this->factory->createNamed('name', static::TESTED_TYPE, null, [
+            'em' => 'default',
+            'class' => self::SINGLE_IDENT_CLASS,
+            'query_builder' => $repository->createQueryBuilder('e')
+                ->where('e.id IN (1, 2, 3)')
+                ->setMaxResults(1),
+            'choice_label' => 'name',
+        ]);
+
+        $field->submit('1');
+
+        $this->assertTrue($field->isSynchronized());
+        $this->assertSame($entity1, $field->getData());
+    }
+
+    public function testDisallowChoicesThatAreNotIncludedByQueryBuilderSingleIdentifierWithLimit()
     {
         $entity1 = new SingleIntIdEntity(1, 'Foo');
         $entity2 = new SingleIntIdEntity(2, 'Bar');

From f46e6cb8a086d0c44502cf35e699a1aa0044b11c Mon Sep 17 00:00:00 2001
From: Fabien Potencier 
Date: Tue, 4 Sep 2018 10:27:39 +0200
Subject: [PATCH 049/130] [HttpFoundation][FrameworkBundle] fix support for
 samesite in session cookies

---
 .../DependencyInjection/Configuration.php     |  2 +
 .../FrameworkExtension.php                    |  2 +-
 .../DependencyInjection/ConfigurationTest.php |  1 +
 .../HttpFoundation/Session/SessionUtils.php   | 59 +++++++++++++++++++
 .../Handler/AbstractSessionHandler.php        | 50 +++++++---------
 .../Session/Storage/NativeSessionStorage.php  | 42 +++++++++++--
 .../Storage/Handler/Fixtures/storage.expected |  3 +-
 .../Fixtures/with_cookie_and_session.expected |  1 +
 .../Handler/Fixtures/with_samesite.expected   | 16 +++++
 .../Handler/Fixtures/with_samesite.php        | 13 ++++
 .../with_samesite_and_migration.expected      | 23 ++++++++
 .../Fixtures/with_samesite_and_migration.php  | 15 +++++
 .../Storage/NativeSessionStorageTest.php      |  8 ++-
 13 files changed, 196 insertions(+), 39 deletions(-)
 create mode 100644 src/Symfony/Component/HttpFoundation/Session/SessionUtils.php
 create mode 100644 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.expected
 create mode 100644 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php
 create mode 100644 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.expected
 create mode 100644 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 00316daf55666..67ddeb2f8b2ee 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -20,6 +20,7 @@
 use Symfony\Component\Config\Definition\ConfigurationInterface;
 use Symfony\Component\DependencyInjection\Exception\LogicException;
 use Symfony\Component\Form\Form;
+use Symfony\Component\HttpFoundation\Cookie;
 use Symfony\Component\Lock\Lock;
 use Symfony\Component\Lock\Store\SemaphoreStore;
 use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
@@ -490,6 +491,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
                         ->scalarNode('cookie_domain')->end()
                         ->booleanNode('cookie_secure')->end()
                         ->booleanNode('cookie_httponly')->defaultTrue()->end()
+                        ->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT])->defaultNull()->end()
                         ->booleanNode('use_cookies')->end()
                         ->scalarNode('gc_divisor')->end()
                         ->scalarNode('gc_probability')->defaultValue(1)->end()
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index 3e28e52ad3d0a..1762112a490f0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -867,7 +867,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
         // session storage
         $container->setAlias('session.storage', $config['storage_id'])->setPrivate(true);
         $options = ['cache_limiter' => '0'];
-        foreach (['name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor', 'use_strict_mode'] as $key) {
+        foreach (['name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'cookie_samesite', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor'] as $key) {
             if (isset($config[$key])) {
                 $options[$key] = $config[$key];
             }
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
index e66c9ebfc610f..dbfd38f34d4d5 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
@@ -436,6 +436,7 @@ protected static function getBundleDefaultConfig()
                 'storage_id' => 'session.storage.native',
                 'handler_id' => 'session.handler.native_file',
                 'cookie_httponly' => true,
+                'cookie_samesite' => null,
                 'gc_probability' => 1,
                 'save_path' => '%kernel.cache_dir%/sessions',
                 'metadata_update_threshold' => '0',
diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionUtils.php b/src/Symfony/Component/HttpFoundation/Session/SessionUtils.php
new file mode 100644
index 0000000000000..04a25f7165e4a
--- /dev/null
+++ b/src/Symfony/Component/HttpFoundation/Session/SessionUtils.php
@@ -0,0 +1,59 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Session;
+
+/**
+ * Session utility functions.
+ *
+ * @author Nicolas Grekas 
+ * @author Rémon van de Kamp 
+ *
+ * @internal
+ */
+final class SessionUtils
+{
+    /**
+     * Find the session header amongst the headers that are to be sent, remove it, and return
+     * it so the caller can process it further.
+     */
+    public static function popSessionCookie($sessionName, $sessionId)
+    {
+        $sessionCookie = null;
+        $sessionCookiePrefix = sprintf(' %s=', urlencode($sessionName));
+        $sessionCookieWithId = sprintf('%s%s;', $sessionCookiePrefix, urlencode($sessionId));
+        $otherCookies = [];
+        foreach (headers_list() as $h) {
+            if (0 !== stripos($h, 'Set-Cookie:')) {
+                continue;
+            }
+            if (11 === strpos($h, $sessionCookiePrefix, 11)) {
+                $sessionCookie = $h;
+
+                if (11 !== strpos($h, $sessionCookieWithId, 11)) {
+                    $otherCookies[] = $h;
+                }
+            } else {
+                $otherCookies[] = $h;
+            }
+        }
+        if (null === $sessionCookie) {
+            return null;
+        }
+
+        header_remove('Set-Cookie');
+        foreach ($otherCookies as $h) {
+            header($h, false);
+        }
+
+        return $sessionCookie;
+    }
+}
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php
index 84ba0ebba3f79..ec59d895ce3a3 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php
@@ -11,6 +11,8 @@
 
 namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
 
+use Symfony\Component\HttpFoundation\Session\SessionUtils;
+
 /**
  * This abstract session handler provides a generic implementation
  * of the PHP 7.0 SessionUpdateTimestampHandlerInterface,
@@ -27,7 +29,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess
     private $igbinaryEmptyData;
 
     /**
-     * {@inheritdoc}
+     * @return bool
      */
     public function open($savePath, $sessionName)
     {
@@ -62,7 +64,7 @@ abstract protected function doWrite($sessionId, $data);
     abstract protected function doDestroy($sessionId);
 
     /**
-     * {@inheritdoc}
+     * @return bool
      */
     public function validateId($sessionId)
     {
@@ -73,7 +75,7 @@ public function validateId($sessionId)
     }
 
     /**
-     * {@inheritdoc}
+     * @return string
      */
     public function read($sessionId)
     {
@@ -99,7 +101,7 @@ public function read($sessionId)
     }
 
     /**
-     * {@inheritdoc}
+     * @return bool
      */
     public function write($sessionId, $data)
     {
@@ -124,7 +126,7 @@ public function write($sessionId, $data)
     }
 
     /**
-     * {@inheritdoc}
+     * @return bool
      */
     public function destroy($sessionId)
     {
@@ -135,31 +137,23 @@ public function destroy($sessionId)
             if (!$this->sessionName) {
                 throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', static::class));
             }
-            $sessionCookie = sprintf(' %s=', urlencode($this->sessionName));
-            $sessionCookieWithId = sprintf('%s%s;', $sessionCookie, urlencode($sessionId));
-            $sessionCookieFound = false;
-            $otherCookies = [];
-            foreach (headers_list() as $h) {
-                if (0 !== stripos($h, 'Set-Cookie:')) {
-                    continue;
-                }
-                if (11 === strpos($h, $sessionCookie, 11)) {
-                    $sessionCookieFound = true;
-
-                    if (11 !== strpos($h, $sessionCookieWithId, 11)) {
-                        $otherCookies[] = $h;
-                    }
+            $cookie = SessionUtils::popSessionCookie($this->sessionName, $sessionId);
+
+            /*
+             * We send an invalidation Set-Cookie header (zero lifetime)
+             * when either the session was started or a cookie with
+             * the session name was sent by the client (in which case
+             * we know it's invalid as a valid session cookie would've
+             * started the session).
+             */
+            if (null === $cookie || isset($_COOKIE[$this->sessionName])) {
+                if (\PHP_VERSION_ID < 70300) {
+                    setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), filter_var(ini_get('session.cookie_secure'), FILTER_VALIDATE_BOOLEAN), filter_var(ini_get('session.cookie_httponly'), FILTER_VALIDATE_BOOLEAN));
                 } else {
-                    $otherCookies[] = $h;
-                }
-            }
-            if ($sessionCookieFound) {
-                header_remove('Set-Cookie');
-                foreach ($otherCookies as $h) {
-                    header($h, false);
+                    $params = session_get_cookie_params();
+                    unset($params['lifetime']);
+                    setcookie($this->sessionName, '', $params);
                 }
-            } else {
-                setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), filter_var(ini_get('session.cookie_secure'), FILTER_VALIDATE_BOOLEAN), filter_var(ini_get('session.cookie_httponly'), FILTER_VALIDATE_BOOLEAN));
             }
         }
 
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
index cbf7cadc7e1f9..7502897a4456b 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
@@ -12,6 +12,7 @@
 namespace Symfony\Component\HttpFoundation\Session\Storage;
 
 use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
+use Symfony\Component\HttpFoundation\Session\SessionUtils;
 use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler;
 use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
 use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
@@ -48,6 +49,11 @@ class NativeSessionStorage implements SessionStorageInterface
      */
     protected $metadataBag;
 
+    /**
+     * @var string|null
+     */
+    private $emulateSameSite;
+
     /**
      * Depending on how you want the storage driver to behave you probably
      * want to override this constructor entirely.
@@ -67,6 +73,7 @@ class NativeSessionStorage implements SessionStorageInterface
      * cookie_lifetime, "0"
      * cookie_path, "/"
      * cookie_secure, ""
+     * cookie_samesite, null
      * entropy_file, ""
      * entropy_length, "0"
      * gc_divisor, "100"
@@ -94,9 +101,7 @@ class NativeSessionStorage implements SessionStorageInterface
      * trans_sid_hosts, $_SERVER['HTTP_HOST']
      * trans_sid_tags, "a=href,area=href,frame=src,form="
      *
-     * @param array                         $options Session configuration options
-     * @param \SessionHandlerInterface|null $handler
-     * @param MetadataBag                   $metaBag MetadataBag
+     * @param AbstractProxy|\SessionHandlerInterface|null $handler
      */
     public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null)
     {
@@ -150,6 +155,13 @@ public function start()
             throw new \RuntimeException('Failed to start the session');
         }
 
+        if (null !== $this->emulateSameSite) {
+            $originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
+            if (null !== $originalCookie) {
+                header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite), false);
+            }
+        }
+
         $this->loadSession();
 
         return true;
@@ -215,6 +227,13 @@ public function regenerate($destroy = false, $lifetime = null)
         // @see https://bugs.php.net/70013
         $this->loadSession();
 
+        if (null !== $this->emulateSameSite) {
+            $originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
+            if (null !== $originalCookie) {
+                header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite), false);
+            }
+        }
+
         return $isRegenerated;
     }
 
@@ -223,6 +242,7 @@ public function regenerate($destroy = false, $lifetime = null)
      */
     public function save()
     {
+        // Store a copy so we can restore the bags in case the session was not left empty
         $session = $_SESSION;
 
         foreach ($this->bags as $bag) {
@@ -248,7 +268,11 @@ public function save()
             session_write_close();
         } finally {
             restore_error_handler();
-            $_SESSION = $session;
+
+            // Restore only if not empty
+            if ($_SESSION) {
+                $_SESSION = $session;
+            }
         }
 
         $this->closed = true;
@@ -347,7 +371,7 @@ public function setOptions(array $options)
 
         $validOptions = array_flip([
             'cache_expire', 'cache_limiter', 'cookie_domain', 'cookie_httponly',
-            'cookie_lifetime', 'cookie_path', 'cookie_secure',
+            'cookie_lifetime', 'cookie_path', 'cookie_secure', 'cookie_samesite',
             'entropy_file', 'entropy_length', 'gc_divisor',
             'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
             'hash_function', 'lazy_write', 'name', 'referer_check',
@@ -360,6 +384,12 @@ public function setOptions(array $options)
 
         foreach ($options as $key => $value) {
             if (isset($validOptions[$key])) {
+                if ('cookie_samesite' === $key && \PHP_VERSION_ID < 70300) {
+                    // PHP < 7.3 does not support same_site cookies. We will emulate it in
+                    // the start() method instead.
+                    $this->emulateSameSite = $value;
+                    continue;
+                }
                 ini_set('url_rewriter.tags' !== $key ? 'session.'.$key : $key, $value);
             }
         }
@@ -381,7 +411,7 @@ public function setOptions(array $options)
      * @see https://php.net/sessionhandlerinterface
      * @see https://php.net/sessionhandler
      *
-     * @param \SessionHandlerInterface|null $saveHandler
+     * @param AbstractProxy|\SessionHandlerInterface|null $saveHandler
      *
      * @throws \InvalidArgumentException
      */
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/storage.expected b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/storage.expected
index 4533a10a1f7cf..05a5d5d0b090f 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/storage.expected
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/storage.expected
@@ -11,10 +11,11 @@ $_SESSION is not empty
 write
 destroy
 close
-$_SESSION is not empty
+$_SESSION is empty
 Array
 (
     [0] => Content-Type: text/plain; charset=utf-8
     [1] => Cache-Control: max-age=0, private, must-revalidate
+    [2] => Set-Cookie: sid=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; secure; HttpOnly
 )
 shutdown
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected
index 5de2d9e3904ed..63078228df139 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected
@@ -20,5 +20,6 @@ Array
     [0] => Content-Type: text/plain; charset=utf-8
     [1] => Cache-Control: max-age=10800, private, must-revalidate
     [2] => Set-Cookie: abc=def
+    [3] => Set-Cookie: sid=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; secure; HttpOnly
 )
 shutdown
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.expected b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.expected
new file mode 100644
index 0000000000000..d20fb88ec052f
--- /dev/null
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.expected
@@ -0,0 +1,16 @@
+open
+validateId
+read
+doRead: 
+read
+
+write
+doWrite: foo|s:3:"bar";
+close
+Array
+(
+    [0] => Content-Type: text/plain; charset=utf-8
+    [1] => Cache-Control: max-age=0, private, must-revalidate
+    [2] => Set-Cookie: sid=random_session_id; path=/; secure; HttpOnly; SameSite=lax
+)
+shutdown
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php
new file mode 100644
index 0000000000000..fc2c4182895ac
--- /dev/null
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php
@@ -0,0 +1,13 @@
+ 'lax']);
+$storage->setSaveHandler(new TestSessionHandler());
+$storage->start();
+
+$_SESSION = ['foo' => 'bar'];
+
+ob_start(function ($buffer) { return str_replace(session_id(), 'random_session_id', $buffer); });
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.expected b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.expected
new file mode 100644
index 0000000000000..8b5fc08bd375b
--- /dev/null
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.expected
@@ -0,0 +1,23 @@
+open
+validateId
+read
+doRead: 
+read
+destroy
+close
+open
+validateId
+read
+doRead: 
+read
+
+write
+doWrite: foo|s:3:"bar";
+close
+Array
+(
+    [0] => Content-Type: text/plain; charset=utf-8
+    [1] => Cache-Control: max-age=0, private, must-revalidate
+    [2] => Set-Cookie: sid=random_session_id; path=/; secure; HttpOnly; SameSite=lax
+)
+shutdown
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php
new file mode 100644
index 0000000000000..a28b6fedfc375
--- /dev/null
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php
@@ -0,0 +1,15 @@
+ 'lax']);
+$storage->setSaveHandler(new TestSessionHandler());
+$storage->start();
+
+$_SESSION = ['foo' => 'bar'];
+
+$storage->regenerate(true);
+
+ob_start(function ($buffer) { return preg_replace('~_sf2_meta.*$~m', '', str_replace(session_id(), 'random_session_id', $buffer)); });
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
index 9ce8108dacc61..d2cf324525443 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
@@ -36,7 +36,7 @@ class NativeSessionStorageTest extends TestCase
     protected function setUp()
     {
         $this->iniSet('session.save_handler', 'files');
-        $this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sf2test');
+        $this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sftest');
         if (!is_dir($this->savePath)) {
             mkdir($this->savePath);
         }
@@ -167,6 +167,10 @@ public function testCookieOptions()
             'cookie_httponly' => false,
         ];
 
+        if (\PHP_VERSION_ID >= 70300) {
+            $options['cookie_samesite'] = 'lax';
+        }
+
         $this->getStorage($options);
         $temp = session_get_cookie_params();
         $gco = [];
@@ -175,8 +179,6 @@ public function testCookieOptions()
             $gco['cookie_'.$key] = $value;
         }
 
-        unset($gco['cookie_samesite']);
-
         $this->assertEquals($options, $gco);
     }
 

From 474be9613b7859518ef9812cfa734bb382370b66 Mon Sep 17 00:00:00 2001
From: Peter Bowyer 
Date: Thu, 6 Feb 2020 11:22:44 +0000
Subject: [PATCH 050/130] [Workflow] Make method signature compatible with 4.4

---
 src/Symfony/Component/Workflow/Event/Event.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Workflow/Event/Event.php b/src/Symfony/Component/Workflow/Event/Event.php
index a0bb4c5176cfe..cda6e170becd5 100644
--- a/src/Symfony/Component/Workflow/Event/Event.php
+++ b/src/Symfony/Component/Workflow/Event/Event.php
@@ -60,7 +60,7 @@ public function getWorkflowName()
         return $this->workflow->getName();
     }
 
-    public function getMetadata(string $key, object $subject)
+    public function getMetadata(string $key, $subject)
     {
         return $this->workflow->getMetadataStore()->getMetadata($key, $subject);
     }

From cd2dec3a7f60b2dc052721b17a7e9f53d15b110b Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Thu, 6 Feb 2020 18:00:39 +0100
Subject: [PATCH 051/130] [PhpUnitBridge] cs fix

---
 src/Symfony/Bridge/PhpUnit/ClockMock.php      |  2 +-
 src/Symfony/Bridge/PhpUnit/DnsMock.php        | 16 ++++-----
 .../Bridge/PhpUnit/Legacy/CommandForV5.php    |  2 +-
 .../PhpUnit/Legacy/CoverageListenerTrait.php  | 14 ++++----
 .../Legacy/SymfonyTestsListenerForV5.php      |  2 +-
 .../Legacy/SymfonyTestsListenerForV6.php      |  3 +-
 .../Legacy/SymfonyTestsListenerForV7.php      |  3 +-
 .../Legacy/SymfonyTestsListenerTrait.php      | 34 +++++++++----------
 .../DeprecationTest.php                       |  8 ++---
 9 files changed, 40 insertions(+), 44 deletions(-)

diff --git a/src/Symfony/Bridge/PhpUnit/ClockMock.php b/src/Symfony/Bridge/PhpUnit/ClockMock.php
index 6876e3389fde5..2cc834cd4f679 100644
--- a/src/Symfony/Bridge/PhpUnit/ClockMock.php
+++ b/src/Symfony/Bridge/PhpUnit/ClockMock.php
@@ -94,7 +94,7 @@ public static function register($class)
     {
         $self = \get_called_class();
 
-        $mockedNs = array(substr($class, 0, strrpos($class, '\\')));
+        $mockedNs = [substr($class, 0, strrpos($class, '\\'))];
         if (0 < strpos($class, '\\Tests\\')) {
             $ns = str_replace('\\Tests\\', '\\', $class);
             $mockedNs[] = substr($ns, 0, strrpos($ns, '\\'));
diff --git a/src/Symfony/Bridge/PhpUnit/DnsMock.php b/src/Symfony/Bridge/PhpUnit/DnsMock.php
index 790cfa91af5c2..a58bf2efcde35 100644
--- a/src/Symfony/Bridge/PhpUnit/DnsMock.php
+++ b/src/Symfony/Bridge/PhpUnit/DnsMock.php
@@ -16,8 +16,8 @@
  */
 class DnsMock
 {
-    private static $hosts = array();
-    private static $dnsTypes = array(
+    private static $hosts = [];
+    private static $dnsTypes = [
         'A' => DNS_A,
         'MX' => DNS_MX,
         'NS' => DNS_NS,
@@ -30,7 +30,7 @@ class DnsMock
         'NAPTR' => DNS_NAPTR,
         'TXT' => DNS_TXT,
         'HINFO' => DNS_HINFO,
-    );
+    ];
 
     /**
      * Configures the mock values for DNS queries.
@@ -68,7 +68,7 @@ public static function getmxrr($hostname, &$mxhosts, &$weight = null)
         if (!self::$hosts) {
             return \getmxrr($hostname, $mxhosts, $weight);
         }
-        $mxhosts = $weight = array();
+        $mxhosts = $weight = [];
 
         if (isset(self::$hosts[$hostname])) {
             foreach (self::$hosts[$hostname] as $record) {
@@ -125,7 +125,7 @@ public static function gethostbynamel($hostname)
         $ips = false;
 
         if (isset(self::$hosts[$hostname])) {
-            $ips = array();
+            $ips = [];
 
             foreach (self::$hosts[$hostname] as $record) {
                 if ('A' === $record['type']) {
@@ -149,11 +149,11 @@ public static function dns_get_record($hostname, $type = DNS_ANY, &$authns = nul
             if (DNS_ANY === $type) {
                 $type = DNS_ALL;
             }
-            $records = array();
+            $records = [];
 
             foreach (self::$hosts[$hostname] as $record) {
                 if (isset(self::$dnsTypes[$record['type']]) && (self::$dnsTypes[$record['type']] & $type)) {
-                    $records[] = array_merge(array('host' => $hostname, 'class' => 'IN', 'ttl' => 1, 'type' => $record['type']), $record);
+                    $records[] = array_merge(['host' => $hostname, 'class' => 'IN', 'ttl' => 1, 'type' => $record['type']], $record);
                 }
             }
         }
@@ -165,7 +165,7 @@ public static function register($class)
     {
         $self = \get_called_class();
 
-        $mockedNs = array(substr($class, 0, strrpos($class, '\\')));
+        $mockedNs = [substr($class, 0, strrpos($class, '\\'))];
         if (0 < strpos($class, '\\Tests\\')) {
             $ns = str_replace('\\Tests\\', '\\', $class);
             $mockedNs[] = substr($ns, 0, strrpos($ns, '\\'));
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/CommandForV5.php b/src/Symfony/Bridge/PhpUnit/Legacy/CommandForV5.php
index ed4128482f91f..2ce390df38609 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/CommandForV5.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/CommandForV5.php
@@ -23,7 +23,7 @@ class CommandForV5 extends \PHPUnit_TextUI_Command
      */
     protected function createRunner()
     {
-        $this->arguments['listeners'] = isset($this->arguments['listeners']) ? $this->arguments['listeners'] : array();
+        $this->arguments['listeners'] = isset($this->arguments['listeners']) ? $this->arguments['listeners'] : [];
 
         $registeredLocally = false;
 
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
index 6c42d3bf26439..7a64ed0d91cd5 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
@@ -32,7 +32,7 @@ public function __construct(callable $sutFqcnResolver = null, $warningOnSutNotFo
     {
         $this->sutFqcnResolver = $sutFqcnResolver;
         $this->warningOnSutNotFound = $warningOnSutNotFound;
-        $this->warnings = array();
+        $this->warnings = [];
     }
 
     public function startTest($test)
@@ -43,7 +43,7 @@ public function startTest($test)
 
         $annotations = $test->getAnnotations();
 
-        $ignoredAnnotations = array('covers', 'coversDefaultClass', 'coversNothing');
+        $ignoredAnnotations = ['covers', 'coversDefaultClass', 'coversNothing'];
 
         foreach ($ignoredAnnotations as $annotation) {
             if (isset($annotations['class'][$annotation]) || isset($annotations['method'][$annotation])) {
@@ -70,11 +70,11 @@ public function startTest($test)
         $r->setAccessible(true);
 
         $cache = $r->getValue();
-        $cache = array_replace_recursive($cache, array(
-            \get_class($test) => array(
-                'covers' => \is_array($sutFqcn) ? $sutFqcn : array($sutFqcn),
-            ),
-        ));
+        $cache = array_replace_recursive($cache, [
+            \get_class($test) => [
+                'covers' => \is_array($sutFqcn) ? $sutFqcn : [$sutFqcn],
+            ],
+        ]);
         $r->setValue(Test::class, $cache);
     }
 
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV5.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV5.php
index a760d126ca854..9b646dca8dfab 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV5.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV5.php
@@ -22,7 +22,7 @@ class SymfonyTestsListenerForV5 extends \PHPUnit_Framework_BaseTestListener
 {
     private $trait;
 
-    public function __construct(array $mockedNamespaces = array())
+    public function __construct(array $mockedNamespaces = [])
     {
         $this->trait = new SymfonyTestsListenerTrait($mockedNamespaces);
     }
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV6.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV6.php
index bcab4be4eeb25..8f2f6b5a7ed54 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV6.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV6.php
@@ -14,7 +14,6 @@
 use PHPUnit\Framework\BaseTestListener;
 use PHPUnit\Framework\Test;
 use PHPUnit\Framework\TestSuite;
-use PHPUnit\Framework\Warning;
 
 /**
  * Collects and replays skipped tests.
@@ -27,7 +26,7 @@ class SymfonyTestsListenerForV6 extends BaseTestListener
 {
     private $trait;
 
-    public function __construct(array $mockedNamespaces = array())
+    public function __construct(array $mockedNamespaces = [])
     {
         $this->trait = new SymfonyTestsListenerTrait($mockedNamespaces);
     }
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV7.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV7.php
index 0c2069c66bf5e..15f60a453f5be 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV7.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV7.php
@@ -15,7 +15,6 @@
 use PHPUnit\Framework\TestListener;
 use PHPUnit\Framework\TestListenerDefaultImplementation;
 use PHPUnit\Framework\TestSuite;
-use PHPUnit\Framework\Warning;
 
 /**
  * Collects and replays skipped tests.
@@ -30,7 +29,7 @@ class SymfonyTestsListenerForV7 implements TestListener
 
     private $trait;
 
-    public function __construct(array $mockedNamespaces = array())
+    public function __construct(array $mockedNamespaces = [])
     {
         $this->trait = new SymfonyTestsListenerTrait($mockedNamespaces);
     }
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
index 05e886506d38c..1e030825e6fde 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
@@ -35,10 +35,10 @@ class SymfonyTestsListenerTrait
     private static $globallyEnabled = false;
     private $state = -1;
     private $skippedFile = false;
-    private $wasSkipped = array();
-    private $isSkipped = array();
-    private $expectedDeprecations = array();
-    private $gatheredDeprecations = array();
+    private $wasSkipped = [];
+    private $isSkipped = [];
+    private $expectedDeprecations = [];
+    private $gatheredDeprecations = [];
     private $previousErrorHandler;
     private $error;
     private $runsInSeparateProcess = false;
@@ -46,7 +46,7 @@ class SymfonyTestsListenerTrait
     /**
      * @param array $mockedNamespaces List of namespaces, indexed by mocked features (time-sensitive or dns-sensitive)
      */
-    public function __construct(array $mockedNamespaces = array())
+    public function __construct(array $mockedNamespaces = [])
     {
         Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait'] = 2;
 
@@ -54,7 +54,7 @@ public function __construct(array $mockedNamespaces = array())
 
         foreach ($mockedNamespaces as $type => $namespaces) {
             if (!\is_array($namespaces)) {
-                $namespaces = array($namespaces);
+                $namespaces = [$namespaces];
             }
             if ('time-sensitive' === $type) {
                 foreach ($namespaces as $ns) {
@@ -140,11 +140,11 @@ public function startTestSuite($suite)
 
                     if (!$this->wasSkipped = require $this->skippedFile) {
                         echo "All tests already ran successfully.\n";
-                        $suite->setTests(array());
+                        $suite->setTests([]);
                     }
                 }
             }
-            $testSuites = array($suite);
+            $testSuites = [$suite];
             for ($i = 0; isset($testSuites[$i]); ++$i) {
                 foreach ($testSuites[$i]->tests() as $test) {
                     if ($test instanceof TestSuite) {
@@ -163,7 +163,7 @@ public function startTestSuite($suite)
                 }
             }
         } elseif (2 === $this->state) {
-            $skipped = array();
+            $skipped = [];
             foreach ($suite->tests() as $test) {
                 if (!($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)
                     || isset($this->wasSkipped[$suiteName]['*'])
@@ -228,7 +228,7 @@ public function startTest($test)
                 $test->getTestResultObject()->beStrictAboutTestsThatDoNotTestAnything(false);
 
                 $this->expectedDeprecations = $annotations['method']['expectedDeprecation'];
-                $this->previousErrorHandler = set_error_handler(array($this, 'handleError'));
+                $this->previousErrorHandler = set_error_handler([$this, 'handleError']);
             }
         }
     }
@@ -251,8 +251,8 @@ public function endTest($test, $time)
             $deprecations = file_get_contents($this->runsInSeparateProcess);
             unlink($this->runsInSeparateProcess);
             putenv('SYMFONY_DEPRECATIONS_SERIALIZE');
-            foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) {
-                $error = serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false), 'triggering_file' => isset($deprecation[2]) ? $deprecation[2] : null));
+            foreach ($deprecations ? unserialize($deprecations) : [] as $deprecation) {
+                $error = serialize(['deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false), 'triggering_file' => isset($deprecation[2]) ? $deprecation[2] : null]);
                 if ($deprecation[0]) {
                     // unsilenced on purpose
                     trigger_error($error, E_USER_DEPRECATED);
@@ -264,13 +264,13 @@ public function endTest($test, $time)
         }
 
         if ($this->expectedDeprecations) {
-            if (!\in_array($test->getStatus(), array(BaseTestRunner::STATUS_SKIPPED, BaseTestRunner::STATUS_INCOMPLETE), true)) {
+            if (!\in_array($test->getStatus(), [BaseTestRunner::STATUS_SKIPPED, BaseTestRunner::STATUS_INCOMPLETE], true)) {
                 $test->addToAssertionCount(\count($this->expectedDeprecations));
             }
 
             restore_error_handler();
 
-            if (!$errored && !\in_array($test->getStatus(), array(BaseTestRunner::STATUS_SKIPPED, BaseTestRunner::STATUS_INCOMPLETE, BaseTestRunner::STATUS_FAILURE, BaseTestRunner::STATUS_ERROR), true)) {
+            if (!$errored && !\in_array($test->getStatus(), [BaseTestRunner::STATUS_SKIPPED, BaseTestRunner::STATUS_INCOMPLETE, BaseTestRunner::STATUS_FAILURE, BaseTestRunner::STATUS_ERROR], true)) {
                 try {
                     $prefix = "@expectedDeprecation:\n";
                     $test->assertStringMatchesFormat($prefix.'%A  '.implode("\n%A  ", $this->expectedDeprecations)."\n%A", $prefix.'  '.implode("\n  ", $this->gatheredDeprecations)."\n");
@@ -279,7 +279,7 @@ public function endTest($test, $time)
                 }
             }
 
-            $this->expectedDeprecations = $this->gatheredDeprecations = array();
+            $this->expectedDeprecations = $this->gatheredDeprecations = [];
             $this->previousErrorHandler = null;
         }
         if (!$this->runsInSeparateProcess && -2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
@@ -287,12 +287,12 @@ public function endTest($test, $time)
                 ClockMock::withClockMock(false);
             }
             if (\in_array('dns-sensitive', $groups, true)) {
-                DnsMock::withMockedHosts(array());
+                DnsMock::withMockedHosts([]);
             }
         }
     }
 
-    public function handleError($type, $msg, $file, $line, $context = array())
+    public function handleError($type, $msg, $file, $line, $context = [])
     {
         if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
             $h = $this->previousErrorHandler;
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
index f4b418961c94b..fd6d059e440c2 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php
@@ -11,7 +11,6 @@
 
 namespace Symfony\Bridge\PhpUnit\Tests\DeprecationErrorHandler;
 
-use Composer\Autoload\ClassLoader;
 use PHPUnit\Framework\TestCase;
 use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
 use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation;
@@ -46,7 +45,6 @@ private static function getVendorDir()
         touch($vendorDir.'/myfakevendor/myfakepackage1/MyFakeFile2.php');
         touch($vendorDir.'/myfakevendor/myfakepackage2/MyFakeFile.php');
 
-
         return self::$vendorDir;
     }
 
@@ -106,12 +104,12 @@ public function mutedProvider()
         yield 'not from phpunit, and not a whitelisted message' => [
             false,
             \My\Source\Code::class,
-            'Self deprecating humor is deprecated by itself'
+            'Self deprecating humor is deprecated by itself',
         ];
         yield 'from phpunit, but not a whitelisted message' => [
             false,
             \PHPUnit\Random\Piece\Of\Code::class,
-            'Self deprecating humor is deprecated by itself'
+            'Self deprecating humor is deprecated by itself',
         ];
         yield 'whitelisted message, but not from phpunit' => [
             false,
@@ -146,7 +144,7 @@ public function testItTakesMutesDeprecationFromPhpUnitFiles()
                 ['file' => 'should_not_matter.php'],
                 ['file' => 'should_not_matter_either.php'],
             ],
-            'random_path' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'phpunit' . \DIRECTORY_SEPARATOR . 'whatever.php'
+            'random_path'.\DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'phpunit'.\DIRECTORY_SEPARATOR.'whatever.php'
         );
         $this->assertTrue($deprecation->isMuted());
     }

From 3604bb701885fb5330175c96b91522420a7e0496 Mon Sep 17 00:00:00 2001
From: Wim Molenberghs 
Date: Fri, 7 Feb 2020 07:50:31 +0100
Subject: [PATCH 052/130] Update UserPasswordEncoderCommand.php

---
 .../SecurityBundle/Command/UserPasswordEncoderCommand.php   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php
index a5537eca5d208..3f33624432f65 100644
--- a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php
+++ b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php
@@ -87,16 +87,16 @@ protected function configure()
 Pass the full user class path as the second argument to encode passwords for
 your own entities:
 
-  php %command.full_name% --no-interaction [password] App\Entity\User
+  php %command.full_name% --no-interaction [password] 'App\Entity\User'
 
 Executing the command interactively allows you to generate a random salt for
 encoding the password:
 
-  php %command.full_name% [password] App\Entity\User
+  php %command.full_name% [password] 'App\Entity\User'
 
 In case your encoder doesn't require a salt, add the empty-salt option:
 
-  php %command.full_name% --empty-salt [password] App\Entity\User
+  php %command.full_name% --empty-salt [password] 'App\Entity\User'
 
 EOF
             )

From ef157d5b3f299206d0a76f1d2f63b684a14db02c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= 
Date: Mon, 7 Oct 2019 22:32:49 +0200
Subject: [PATCH 053/130] [Console] Consider STDIN interactive

---
 src/Symfony/Component/Console/Application.php | 11 --------
 .../Console/Tester/ApplicationTester.php      |  9 +-----
 .../phpt/uses_stdin_as_interactive_input.phpt | 28 +++++++++++++++++++
 3 files changed, 29 insertions(+), 19 deletions(-)
 create mode 100644 src/Symfony/Component/Console/Tests/phpt/uses_stdin_as_interactive_input.phpt

diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php
index 410900cc2bcfa..acd32687880c5 100644
--- a/src/Symfony/Component/Console/Application.php
+++ b/src/Symfony/Component/Console/Application.php
@@ -36,7 +36,6 @@
 use Symfony\Component\Console\Input\InputDefinition;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
-use Symfony\Component\Console\Input\StreamableInputInterface;
 use Symfony\Component\Console\Output\ConsoleOutput;
 use Symfony\Component\Console\Output\ConsoleOutputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
@@ -947,16 +946,6 @@ protected function configureIO(InputInterface $input, OutputInterface $output)
 
         if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
             $input->setInteractive(false);
-        } elseif (\function_exists('posix_isatty')) {
-            $inputStream = null;
-
-            if ($input instanceof StreamableInputInterface) {
-                $inputStream = $input->getStream();
-            }
-
-            if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
-                $input->setInteractive(false);
-            }
         }
 
         switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) {
diff --git a/src/Symfony/Component/Console/Tester/ApplicationTester.php b/src/Symfony/Component/Console/Tester/ApplicationTester.php
index ced56cff208bb..4f99da18d5f8b 100644
--- a/src/Symfony/Component/Console/Tester/ApplicationTester.php
+++ b/src/Symfony/Component/Console/Tester/ApplicationTester.php
@@ -59,19 +59,12 @@ public function run(array $input, $options = [])
             $this->input->setInteractive($options['interactive']);
         }
 
-        $shellInteractive = getenv('SHELL_INTERACTIVE');
-
         if ($this->inputs) {
             $this->input->setStream(self::createStream($this->inputs));
-            putenv('SHELL_INTERACTIVE=1');
         }
 
         $this->initOutput($options);
 
-        $this->statusCode = $this->application->run($this->input, $this->output);
-
-        putenv($shellInteractive ? "SHELL_INTERACTIVE=$shellInteractive" : 'SHELL_INTERACTIVE');
-
-        return $this->statusCode;
+        return $this->statusCode = $this->application->run($this->input, $this->output);
     }
 }
diff --git a/src/Symfony/Component/Console/Tests/phpt/uses_stdin_as_interactive_input.phpt b/src/Symfony/Component/Console/Tests/phpt/uses_stdin_as_interactive_input.phpt
new file mode 100644
index 0000000000000..db1bb4ce436e2
--- /dev/null
+++ b/src/Symfony/Component/Console/Tests/phpt/uses_stdin_as_interactive_input.phpt
@@ -0,0 +1,28 @@
+--STDIN--
+Hello World
+--FILE--
+register('app')
+    ->setCode(function(InputInterface $input, OutputInterface $output) {
+        $output->writeln((new QuestionHelper())->ask($input, $output, new Question('Foo?')));
+    })
+    ->getApplication()
+    ->setDefaultCommand('app', true)
+    ->run()
+;
+--EXPECT--
+Foo?Hello World

From abac71b0a44bfb11c60e21a3f50f0ca3c16021d2 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Fri, 7 Feb 2020 09:43:36 +0100
Subject: [PATCH 054/130] [FrameworkBundle] fix "samesite" in XSD

---
 .../DependencyInjection/Configuration.php              |  2 +-
 .../Resources/config/schema/symfony-1.0.xsd            | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 67ddeb2f8b2ee..400c8a7920b8f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -491,7 +491,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
                         ->scalarNode('cookie_domain')->end()
                         ->booleanNode('cookie_secure')->end()
                         ->booleanNode('cookie_httponly')->defaultTrue()->end()
-                        ->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT])->defaultNull()->end()
+                        ->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->defaultNull()->end()
                         ->booleanNode('use_cookies')->end()
                         ->scalarNode('gc_divisor')->end()
                         ->scalarNode('gc_probability')->defaultValue(1)->end()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
index 531f7dddb970f..39011822e99e9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
@@ -113,6 +113,7 @@
         
         
         
+        
         
         
         
@@ -306,6 +307,15 @@
         
     
 
+    
+        
+            
+            
+            
+            
+        
+    
+
     
         
             

From 02e5d73116daa77164e84dfaaa44b77f9a3bf774 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Fri, 7 Feb 2020 10:11:45 +0100
Subject: [PATCH 055/130] [FrameworkBundle] fix deps=low

---
 src/Symfony/Bundle/FrameworkBundle/composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json
index dae941c1f780e..020e4f1b475eb 100644
--- a/src/Symfony/Bundle/FrameworkBundle/composer.json
+++ b/src/Symfony/Bundle/FrameworkBundle/composer.json
@@ -24,7 +24,7 @@
         "symfony/config": "^3.4.31|^4.3.4",
         "symfony/debug": "~2.8|~3.0|~4.0",
         "symfony/event-dispatcher": "~3.4|~4.0",
-        "symfony/http-foundation": "^3.4.13|~4.3",
+        "symfony/http-foundation": "^3.4.37|^4.4.5",
         "symfony/http-kernel": "^3.4.31|^4.3.4",
         "symfony/polyfill-mbstring": "~1.0",
         "symfony/filesystem": "~2.8|~3.0|~4.0",

From 16dd360511ceadf81d90d30db2cd29e73bab5b00 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Fri, 7 Feb 2020 10:12:20 +0100
Subject: [PATCH 056/130] [FrameworkBundle] fix fix deps=low

---
 src/Symfony/Bundle/FrameworkBundle/composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json
index 020e4f1b475eb..0cfc665551844 100644
--- a/src/Symfony/Bundle/FrameworkBundle/composer.json
+++ b/src/Symfony/Bundle/FrameworkBundle/composer.json
@@ -24,7 +24,7 @@
         "symfony/config": "^3.4.31|^4.3.4",
         "symfony/debug": "~2.8|~3.0|~4.0",
         "symfony/event-dispatcher": "~3.4|~4.0",
-        "symfony/http-foundation": "^3.4.37|^4.4.5",
+        "symfony/http-foundation": "^3.4.38|^4.4.5",
         "symfony/http-kernel": "^3.4.31|^4.3.4",
         "symfony/polyfill-mbstring": "~1.0",
         "symfony/filesystem": "~2.8|~3.0|~4.0",

From 47f467a4cc56ae0490284591e230e067878d0489 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Fri, 7 Feb 2020 10:13:59 +0100
Subject: [PATCH 057/130] [FrameworkBundle] fix fix fix deps=low

---
 src/Symfony/Bundle/FrameworkBundle/composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json
index 0cfc665551844..aad4e3fc612f0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/composer.json
+++ b/src/Symfony/Bundle/FrameworkBundle/composer.json
@@ -24,7 +24,7 @@
         "symfony/config": "^3.4.31|^4.3.4",
         "symfony/debug": "~2.8|~3.0|~4.0",
         "symfony/event-dispatcher": "~3.4|~4.0",
-        "symfony/http-foundation": "^3.4.38|^4.4.5",
+        "symfony/http-foundation": "^3.4.38|^4.3",
         "symfony/http-kernel": "^3.4.31|^4.3.4",
         "symfony/polyfill-mbstring": "~1.0",
         "symfony/filesystem": "~2.8|~3.0|~4.0",

From 076a2a0a71749a9a9e2ba69a669cafd55cb74643 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Fri, 7 Feb 2020 10:30:39 +0100
Subject: [PATCH 058/130] [travis] fix patching return types of
 symfony/contracts

---
 .travis.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 29e9da2cc5224..ab66bbbed99ad 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -285,7 +285,7 @@ install:
               (cd src/Symfony/Component/HttpFoundation; mv composer.bak composer.json)
               COMPONENTS=$(git diff --name-only src/ | grep composer.json || true)
 
-              if [[ $COMPONENTS && $LEGACY && $TRAVIS_PULL_REQUEST != false ]]; then
+              if [[ $COMPONENTS && $LEGACY && $TRAVIS_BRANCH != master && $TRAVIS_PULL_REQUEST != false ]]; then
                   export FLIP='🙃'
                   SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}')
                   echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m"
@@ -309,7 +309,7 @@ install:
           else
               if [[ $PHP = 7.4* ]]; then
                   # add return types before running the test suite
-                  rm vendor/symfony/contracts -Rf
+                  rm src/Symfony/Contract -Rf && mv vendor/symfony/contracts src/Symfony/Contract
                   ln -sd $(realpath src/Symfony/Contracts) vendor/symfony/contracts
                   sed -i 's/"\*\*\/Tests\/"//' composer.json
                   composer install --optimize-autoloader

From 05663c338f63a072ac95290b196ff79c7aab7af9 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Fri, 7 Feb 2020 11:18:08 +0100
Subject: [PATCH 059/130] Fix typo

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index ab66bbbed99ad..a5246b3eafb58 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -309,7 +309,7 @@ install:
           else
               if [[ $PHP = 7.4* ]]; then
                   # add return types before running the test suite
-                  rm src/Symfony/Contract -Rf && mv vendor/symfony/contracts src/Symfony/Contract
+                  rm src/Symfony/Contracts -Rf && mv vendor/symfony/contracts src/Symfony/Contracts
                   ln -sd $(realpath src/Symfony/Contracts) vendor/symfony/contracts
                   sed -i 's/"\*\*\/Tests\/"//' composer.json
                   composer install --optimize-autoloader

From 28178108d3ce3df0eedb4a5c38975da33be35186 Mon Sep 17 00:00:00 2001
From: Michel Hunziker 
Date: Fri, 7 Feb 2020 14:16:26 +0100
Subject: [PATCH 060/130] [Mailer] Do not ping the SMTP server before sending
 every message

---
 .../Transport/Smtp/SmtpTransportTest.php      | 95 +++++++++++++++++++
 .../Mailer/Transport/Smtp/SmtpTransport.php   | 32 ++++++-
 2 files changed, 126 insertions(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/SmtpTransportTest.php b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/SmtpTransportTest.php
index 659062d947f16..7ec8313612049 100644
--- a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/SmtpTransportTest.php
+++ b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/SmtpTransportTest.php
@@ -12,8 +12,12 @@
 namespace Symfony\Component\Mailer\Tests\Transport\Smtp;
 
 use PHPUnit\Framework\TestCase;
+use Symfony\Component\Mailer\Envelope;
 use Symfony\Component\Mailer\Transport\Smtp\SmtpTransport;
+use Symfony\Component\Mailer\Transport\Smtp\Stream\AbstractStream;
 use Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream;
+use Symfony\Component\Mime\Address;
+use Symfony\Component\Mime\RawMessage;
 
 class SmtpTransportTest extends TestCase
 {
@@ -25,4 +29,95 @@ public function testToString()
         $t = new SmtpTransport((new SocketStream())->setHost('127.0.0.1')->setPort(2525)->disableTls());
         $this->assertEquals('smtp://127.0.0.1:2525', (string) $t);
     }
+
+    public function testSendDoesNotPingBelowThreshold(): void
+    {
+        $stream = new DummyStream();
+        $envelope = new Envelope(new Address('sender@example.org'), [new Address('recipient@example.org')]);
+
+        $transport = new SmtpTransport($stream);
+        $transport->send(new RawMessage('Message 1'), $envelope);
+        $transport->send(new RawMessage('Message 2'), $envelope);
+        $transport->send(new RawMessage('Message 3'), $envelope);
+
+        $this->assertNotContains("NOOP\r\n", $stream->getCommands());
+    }
+
+    public function testSendDoesPingAboveThreshold(): void
+    {
+        $stream = new DummyStream();
+        $envelope = new Envelope(new Address('sender@example.org'), [new Address('recipient@example.org')]);
+
+        $transport = new SmtpTransport($stream);
+        $transport->setPingThreshold(1);
+
+        $transport->send(new RawMessage('Message 1'), $envelope);
+        $transport->send(new RawMessage('Message 2'), $envelope);
+
+        $this->assertNotContains("NOOP\r\n", $stream->getCommands());
+
+        $stream->clearCommands();
+        sleep(1);
+
+        $transport->send(new RawMessage('Message 3'), $envelope);
+        $this->assertContains("NOOP\r\n", $stream->getCommands());
+    }
+}
+
+class DummyStream extends AbstractStream
+{
+    /**
+     * @var string
+     */
+    private $nextResponse;
+
+    /**
+     * @var string[]
+     */
+    private $commands;
+
+    public function initialize(): void
+    {
+        $this->nextResponse = '220 localhost';
+    }
+
+    public function write(string $bytes, $debug = true): void
+    {
+        $this->commands[] = $bytes;
+
+        if (0 === strpos($bytes, 'DATA')) {
+            $this->nextResponse = '354 Enter message, ending with "." on a line by itself';
+        } elseif (0 === strpos($bytes, 'QUIT')) {
+            $this->nextResponse = '221 Goodbye';
+        } else {
+            $this->nextResponse = '250 OK';
+        }
+    }
+
+    public function readLine(): string
+    {
+        return $this->nextResponse;
+    }
+
+    public function flush(): void
+    {
+    }
+
+    /**
+     * @return string[]
+     */
+    public function getCommands(): array
+    {
+        return $this->commands;
+    }
+
+    public function clearCommands(): void
+    {
+        $this->commands = [];
+    }
+
+    protected function getReadConnectionDescription(): string
+    {
+        return 'null';
+    }
 }
diff --git a/src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php b/src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php
index cb3b4e0ae54c1..091b5e2bc5a60 100644
--- a/src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php
+++ b/src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php
@@ -35,6 +35,8 @@ class SmtpTransport extends AbstractTransport
     private $restartThreshold = 100;
     private $restartThresholdSleep = 0;
     private $restartCounter;
+    private $pingThreshold = 100;
+    private $lastMessageTime = 0;
     private $stream;
     private $domain = '[127.0.0.1]';
 
@@ -66,6 +68,28 @@ public function setRestartThreshold(int $threshold, int $sleep = 0): self
         return $this;
     }
 
+    /**
+     * Sets the minimum number of seconds required between two messages, before the server is pinged.
+     * If the transport wants to send a message and the time since the last message exceeds the specified threshold,
+     * the transport will ping the server first (NOOP command) to check if the connection is still alive.
+     * Otherwise the message will be sent without pinging the server first.
+     *
+     * Do not set the threshold too low, as the SMTP server may drop the connection if there are too many
+     * non-mail commands (like pinging the server with NOOP).
+     *
+     * By default, the threshold is set to 100 seconds.
+     *
+     * @param int $seconds The minimum number of seconds between two messages required to ping the server
+     *
+     * @return $this
+     */
+    public function setPingThreshold(int $seconds): self
+    {
+        $this->pingThreshold = $seconds;
+
+        return $this;
+    }
+
     /**
      * Sets the name of the local domain that will be used in HELO.
      *
@@ -160,7 +184,10 @@ public function executeCommand(string $command, array $codes): string
 
     protected function doSend(SentMessage $message): void
     {
-        $this->ping();
+        if (microtime(true) - $this->lastMessageTime > $this->pingThreshold) {
+            $this->ping();
+        }
+
         if (!$this->started) {
             $this->start();
         }
@@ -183,6 +210,8 @@ protected function doSend(SentMessage $message): void
             $e->appendDebug($this->stream->getDebug());
 
             throw $e;
+        } finally {
+            $this->lastMessageTime = microtime(true);
         }
     }
 
@@ -213,6 +242,7 @@ private function start(): void
         $this->assertResponseCode($this->getFullResponse(), [220]);
         $this->doHeloCommand();
         $this->started = true;
+        $this->lastMessageTime = 0;
 
         $this->getLogger()->debug(sprintf('Email transport "%s" started', __CLASS__));
     }

From 7f6d71c2a39650fdf3abcae2636647157ebb1c19 Mon Sep 17 00:00:00 2001
From: Loulier Guillaume 
Date: Fri, 7 Feb 2020 19:31:10 +0100
Subject: [PATCH 061/130] refactor(Process): fromShellCommandLine

---
 src/Symfony/Component/Process/PhpProcess.php          |  9 +++++++++
 .../Component/Process/Tests/PhpProcessTest.php        | 11 +++++++++++
 2 files changed, 20 insertions(+)

diff --git a/src/Symfony/Component/Process/PhpProcess.php b/src/Symfony/Component/Process/PhpProcess.php
index 126d9b754fa8a..22fc1b385afca 100644
--- a/src/Symfony/Component/Process/PhpProcess.php
+++ b/src/Symfony/Component/Process/PhpProcess.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Process;
 
+use Symfony\Component\Process\Exception\LogicException;
 use Symfony\Component\Process\Exception\RuntimeException;
 
 /**
@@ -49,6 +50,14 @@ public function __construct(string $script, string $cwd = null, array $env = nul
         parent::__construct($php, $cwd, $env, $script, $timeout);
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
+    {
+        throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
+    }
+
     /**
      * Sets the path to the PHP binary to use.
      *
diff --git a/src/Symfony/Component/Process/Tests/PhpProcessTest.php b/src/Symfony/Component/Process/Tests/PhpProcessTest.php
index b7b21ebcb160f..5f1e5e6700622 100644
--- a/src/Symfony/Component/Process/Tests/PhpProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/PhpProcessTest.php
@@ -12,6 +12,7 @@
 namespace Symfony\Component\Process\Tests;
 
 use PHPUnit\Framework\TestCase;
+use Symfony\Component\Process\Exception\LogicException;
 use Symfony\Component\Process\PhpExecutableFinder;
 use Symfony\Component\Process\PhpProcess;
 
@@ -60,4 +61,14 @@ public function testPassingPhpExplicitly()
         $process->run();
         $this->assertEquals($expected, $process->getOutput());
     }
+
+    public function testProcessCannotBeCreatedUsingFromShellCommandLine()
+    {
+        static::expectException(LogicException::class);
+        static::expectExceptionMessage('The "Symfony\Component\Process\PhpProcess::fromShellCommandline()" method cannot be called when using "Symfony\Component\Process\PhpProcess".');
+        PhpProcess::fromShellCommandline(<<
Date: Fri, 7 Feb 2020 19:04:34 +0100
Subject: [PATCH 062/130] [ErrorHandler] Never throw on warnings triggered by
 assert() and set assert.exception=1 in Debug::enable()

---
 src/Symfony/Component/ErrorHandler/Debug.php  |  5 +++
 .../Component/ErrorHandler/ErrorHandler.php   |  5 +++
 .../ErrorHandler/Tests/ErrorHandlerTest.php   | 35 +++++++++++++++++++
 3 files changed, 45 insertions(+)

diff --git a/src/Symfony/Component/ErrorHandler/Debug.php b/src/Symfony/Component/ErrorHandler/Debug.php
index 50d1789f09243..a3c0511d220e8 100644
--- a/src/Symfony/Component/ErrorHandler/Debug.php
+++ b/src/Symfony/Component/ErrorHandler/Debug.php
@@ -29,6 +29,11 @@ public static function enable(): ErrorHandler
             ini_set('display_errors', 1);
         }
 
+        ini_set('zend.assertions', 1);
+        ini_set('assert.active', 1);
+        ini_set('assert.warning', 0);
+        ini_set('assert.exception', 1);
+
         DebugClassLoader::enable();
 
         return ErrorHandler::register(new ErrorHandler(new BufferingLogger(), true));
diff --git a/src/Symfony/Component/ErrorHandler/ErrorHandler.php b/src/Symfony/Component/ErrorHandler/ErrorHandler.php
index b3afb53c9efb0..2ac16e380d032 100644
--- a/src/Symfony/Component/ErrorHandler/ErrorHandler.php
+++ b/src/Symfony/Component/ErrorHandler/ErrorHandler.php
@@ -413,6 +413,11 @@ public function handleError(int $type, string $message, string $file, int $line)
         $throw = $this->thrownErrors & $type & $level;
         $type &= $level | $this->screamedErrors;
 
+        // Never throw on warnings triggered by assert()
+        if (E_WARNING === $type && 'a' === $message[0] && 0 === strncmp($message, 'assert(): ', 10)) {
+            $throw = 0;
+        }
+
         if (!$type || (!$log && !$throw)) {
             return !$silenced && $type && $log;
         }
diff --git a/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php b/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php
index 747dbb72dbc1f..70710302fd970 100644
--- a/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php
+++ b/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php
@@ -615,4 +615,39 @@ public function errorHandlerWhenLoggingProvider(): iterable
             }
         }
     }
+
+    public function testAssertQuietEval()
+    {
+        $ini = [
+            ini_set('zend.assertions', 1),
+            ini_set('assert.active', 1),
+            ini_set('assert.bail', 0),
+            ini_set('assert.warning', 1),
+            ini_set('assert.callback', null),
+            ini_set('assert.exception', 0),
+        ];
+
+        $logger = new BufferingLogger();
+        $handler = new ErrorHandler($logger);
+        $handler = ErrorHandler::register($handler);
+
+        try {
+            \assert(false);
+        } finally {
+            restore_error_handler();
+            restore_exception_handler();
+
+            ini_set('zend.assertions', $ini[0]);
+            ini_set('assert.active', $ini[1]);
+            ini_set('assert.bail', $ini[2]);
+            ini_set('assert.warning', $ini[3]);
+            ini_set('assert.callback', $ini[4]);
+            ini_set('assert.exception', $ini[5]);
+        }
+
+        $logs = $logger->cleanLogs();
+
+        $this->assertSame('warning', $logs[0][0]);
+        $this->assertSame('Warning: assert(): assert(false) failed', $logs[0][1]);
+    }
 }

From 365f4d76bd4b22091489d9607ecdcb766d959a9b Mon Sep 17 00:00:00 2001
From: Erkhembayar Gantulga 
Date: Sat, 8 Feb 2020 18:05:56 +0800
Subject: [PATCH 063/130] [Validator] Added the missing Mongolian translations

https://github.com/symfony/symfony/issues/30175

Added the missing translations for the Mongolian ("mn") locale.
---
 .../Resources/translations/validators.mn.xlf  | 220 ++++++++++++++++++
 1 file changed, 220 insertions(+)

diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf
index 4be2198aa3b27..b1458eee1ac0b 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf
@@ -146,6 +146,226 @@
                 This value is not a valid language.
                 Энэ утга үнэн зөв хэл биш байна .
             
+            
+                This value is not a valid country.
+                Энэ утга үнэн бодит улс биш байна.
+            
+            
+                This value is already used.
+                Энэ утга аль хэдийнээ хэрэглэгдсэн байна.
+            
+            
+                The size of the image could not be detected.
+                Зургийн хэмжээ тогтоогдож чадсангүй.
+            
+            
+                The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.
+                Зургийн өргөн хэтэрхий том байна ({{ width }}px). Өргөн нь хамгийн ихдээ {{ max_width }}px байх боломжтой.
+            
+            
+                The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.
+                Зургийн өргөн хэтэрхий жижиг байна ({{ width }}px). Өргөн нь хамгийн багадаа {{ min_width }}px байх боломжтой.
+            
+            
+                The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.
+                Зургийн өндөр хэтэрхий том байна ({{ height }}px). Өндөр нь хамгийн ихдээ {{ max_height }}px байх боломжтой.
+            
+            
+                The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.
+                Зургийн өндөр хэтэрхий жижиг байна ({{ height }}px). Өндөр нь хамгийн багадаа {{ min_height }}px байх боломжтой.
+            
+            
+                This value should be the user's current password.
+                Энэ утга хэрэглэгчийн одоогийн нууц үг байх ёстой.
+            
+            
+                This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.
+                Энэ утга яг {{ limit }} тэмдэгт байх ёстой.|Энэ утга яг {{ limit }} тэмдэгт байх ёстой.
+            
+            
+                The file was only partially uploaded.
+                Файлын зөвхөн хагас нь upload хийгдсэн.
+            
+            
+                No file was uploaded.
+                Ямар ч файл upload хийгдсэнгүй.
+            
+            
+                No temporary folder was configured in php.ini.
+                php.ini дээр түр зуурын хавтсыг тохируулаагүй байна, эсвэл тохируулсан хавтас байхгүй байна.
+            
+            
+                Cannot write temporary file to disk.
+                Түр зуурын файлыг диск руу бичиж болохгүй байна.
+            
+            
+                A PHP extension caused the upload to fail.
+                PHP extension нь upload -г амжилтгүй болгоод байна.
+            
+            
+                This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.
+                Энэ коллекц {{ limit }} ба түүнээс дээш тооны элемент агуулах ёстой.|Энэ коллекц {{ limit }} ба түүнээс дээш тооны элемент агуулах ёстой.
+            
+            
+                This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.
+                Энэ коллекц {{ limit }} ба түүнээс доош тооны элемент агуулах ёстой.|Энэ коллекц {{ limit }} ба түүнээс доош тооны элемент агуулах ёстой.
+            
+            
+                This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.
+                Энэ коллекц яг {{ limit }} элемент агуулах ёстой.|Энэ коллекц яг {{ limit }} элемент агуулах ёстой.
+            
+            
+                Invalid card number.
+                Картын дугаар буруу байна.
+            
+            
+                Unsupported card type or invalid card number.
+                Дэмжигдээгүй картын төрөл эсвэл картын дугаар буруу байна.
+            
+            
+                This is not a valid International Bank Account Number (IBAN).
+                Энэ утга үнэн зөв Олон Улсын Банкны Дансны Дугаар (IBAN) биш байна.
+            
+            
+                This value is not a valid ISBN-10.
+                Энэ утга үнэн зөв ISBN-10 биш байна.
+            
+            
+                This value is not a valid ISBN-13.
+                Энэ утга үнэн зөв ISBN-13 биш байна.
+            
+            
+                This value is neither a valid ISBN-10 nor a valid ISBN-13.
+                Энэ утга үнэн зөв ISBN-10 юмуу ISBN-13 биш байна.
+            
+            
+                This value is not a valid ISSN.
+                Энэ утга үнэн зөв ISSN биш байна.
+            
+            
+                This value is not a valid currency.
+                Энэ утга үнэн бодит валют биш байна.
+            
+            
+                This value should be equal to {{ compared_value }}.
+                Энэ утга {{ compared_value }} -тaй тэнцүү байх ёстой.
+            
+            
+                This value should be greater than {{ compared_value }}.
+                Энэ утга {{ compared_value }} -с их байх ёстой.
+            
+            
+                This value should be greater than or equal to {{ compared_value }}.
+                Энэ утга {{ compared_value }} -тай тэнцүү юмуу эсвэл их байх ёстой.
+            
+            
+                This value should be identical to {{ compared_value_type }} {{ compared_value }}.
+                Энэ утга {{ compared_value_type }} {{ compared_value }} -тай яг ижил байх ёстой.
+            
+            
+                This value should be less than {{ compared_value }}.
+                Энэ утга {{ compared_value }} -с бага байх ёстой.
+            
+            
+                This value should be less than or equal to {{ compared_value }}.
+                Энэ утга {{ compared_value }} -тай ижил юмуу эсвэл бага байх ёстой.
+            
+            
+                This value should not be equal to {{ compared_value }}.
+                Энэ утга {{ compared_value }} -тай тэнцүү байх ёсгүй.
+            
+            
+                This value should not be identical to {{ compared_value_type }} {{ compared_value }}.
+                Энэ утга {{ compared_value_type }} {{ compared_value }} -тай яг ижил байх ёсгүй.
+            
+            
+                The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.
+                Зургийн харьцаа хэтэрхий том байна ({{ ratio }}). Харьцаа нь хамгийн ихдээ {{ max_ratio }} байна.
+            
+            
+                The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.
+                Зургийн харьцаа хэтэрхий жижиг байна ({{ ratio }}). Харьцаа нь хамгийн багадаа {{ min_ratio }} байна.
+            
+            
+                The image is square ({{ width }}x{{ height }}px). Square images are not allowed.
+                Зураг дөрвөлжин хэлбэртэй байна ({{ width }}x{{ height }}px). Дөрвөлжин зургууд оруулах боломжгүй.
+            
+            
+                The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.
+                Зураг хэвтээ байрлалтай байна ({{ width }}x{{ height }}px). Хэвтээ байрлалтай зургууд оруулах боломжгүй.
+            
+            
+                The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.
+                Зургууд босоо байрлалтай байна ({{ width }}x{{ height }}px). Босоо байрлалтай зургууд оруулах боломжгүй.
+            
+            
+                An empty file is not allowed.
+                Хоосон файл оруулах боломжгүй.
+            
+            
+                The host could not be resolved.
+                Хост зөв тохирогдоогүй байна.
+            
+            
+                This value does not match the expected {{ charset }} charset.
+                Энэ утга тооцоолсон {{ charset }} тэмдэгттэй таарахгүй байна.
+            
+            
+                This is not a valid Business Identifier Code (BIC).
+                Энэ утга үнэн зөв Business Identifier Code (BIC) биш байна.
+            
+            
+                Error
+                Алдаа
+            
+            
+                This is not a valid UUID.
+                Энэ утга үнэн зөв UUID биш байна.
+            
+            
+                This value should be a multiple of {{ compared_value }}.
+                Энэ утга {{ compared_value }} -н үржвэр байх ёстой.
+            
+            
+                This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.
+                Энэ Business Identifier Code (BIC) код нь IBAN {{ iban }} -тай холбоогүй байна.
+            
+            
+                This value should be valid JSON.
+                Энэ утга JSON байх ёстой.
+            
+            
+                This collection should contain only unique elements.
+                Энэ коллекц зөвхөн давтагдахгүй элементүүд агуулах ёстой.
+            
+            
+                This value should be positive.
+                Энэ утга эерэг байх ёстой.
+            
+            
+                This value should be either positive or zero.
+                Энэ утга тэг эсвэл эерэг байх ёстой.
+            
+            
+                This value should be negative.
+                Энэ утга сөрөг байх ёстой.
+            
+            
+                This value should be either negative or zero.
+                Энэ утга сөрөг эсвэл тэг байх ёстой.
+            
+            
+                This value is not a valid timezone.
+                Энэ утга үнэн зөв цагийн бүс биш байна.
+            
+            
+                This password has been leaked in a data breach, it must not be used. Please use another password.
+                Энэ нууц үгийн мэдээлэл алдагдсан байх магадлалтай учраас дахин ашиглагдах ёсгүй. Өөр нууц үг ашиглана уу.
+            
+            
+                This value should be between {{ min }} and {{ max }}.
+                Энэ утга {{ min }} -с {{ max }} хооронд байх ёстой.
+            
         
     
 

From 48272f000a61bada9ceb613186a6616f1f181903 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Sat, 8 Feb 2020 17:59:15 +0100
Subject: [PATCH 064/130] Add missing symfony/mime to require-dev

---
 src/Symfony/Component/Serializer/composer.json | 1 +
 src/Symfony/Component/Validator/composer.json  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json
index cf48812e1ebf0..a28d18fe4e26f 100644
--- a/src/Symfony/Component/Serializer/composer.json
+++ b/src/Symfony/Component/Serializer/composer.json
@@ -28,6 +28,7 @@
         "symfony/dependency-injection": "^3.4|^4.0|^5.0",
         "symfony/error-handler": "^4.4|^5.0",
         "symfony/http-foundation": "^3.4|^4.0|^5.0",
+        "symfony/mime": "^4.4|^5.0",
         "symfony/property-access": "^3.4|^4.0|^5.0",
         "symfony/property-info": "^3.4.13|~4.0|^5.0",
         "symfony/validator": "^3.4|^4.0|^5.0",
diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json
index fec833702d207..230dfab8e2223 100644
--- a/src/Symfony/Component/Validator/composer.json
+++ b/src/Symfony/Component/Validator/composer.json
@@ -31,6 +31,7 @@
         "symfony/dependency-injection": "^3.4|^4.0|^5.0",
         "symfony/expression-language": "^3.4|^4.0|^5.0",
         "symfony/cache": "^3.4|^4.0|^5.0",
+        "symfony/mime": "^4.4|^5.0",
         "symfony/property-access": "^3.4|^4.0|^5.0",
         "symfony/property-info": "^3.4|^4.0|^5.0",
         "symfony/translation": "^4.2",

From f10098e9f11a121080169218c0c4627127b2f857 Mon Sep 17 00:00:00 2001
From: Robin Chalas 
Date: Sun, 9 Feb 2020 18:57:03 +0100
Subject: [PATCH 065/130] [Security] Fix exception name in doc comments

---
 .../Security/Core/Exception/AuthenticationExpiredException.php  | 2 +-
 .../Security/Guard/Provider/GuardAuthenticationProvider.php     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Symfony/Component/Security/Core/Exception/AuthenticationExpiredException.php b/src/Symfony/Component/Security/Core/Exception/AuthenticationExpiredException.php
index 7bc174f05ce82..b45c948acd353 100644
--- a/src/Symfony/Component/Security/Core/Exception/AuthenticationExpiredException.php
+++ b/src/Symfony/Component/Security/Core/Exception/AuthenticationExpiredException.php
@@ -12,7 +12,7 @@
 namespace Symfony\Component\Security\Core\Exception;
 
 /**
- * AuthenticationServiceException is thrown when an authenticated token becomes un-authenticated between requests.
+ * AuthenticationExpiredException is thrown when an authenticated token becomes un-authenticated between requests.
  *
  * In practice, this is due to the User changing between requests (e.g. password changes),
  * causes the token to become un-authenticated.
diff --git a/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php b/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php
index a78a21d49de0e..26890db367385 100644
--- a/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php
+++ b/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php
@@ -82,7 +82,7 @@ public function authenticate(TokenInterface $token)
                 return $token;
             }
 
-            // this AccountStatusException causes the user to be logged out
+            // this AccountExpiredException causes the user to be logged out
             throw new AuthenticationExpiredException();
         }
 

From 7088ef78f741af1de2209443386c71944c7cca3c Mon Sep 17 00:00:00 2001
From: Matthias Meyer 
Date: Tue, 11 Feb 2020 11:10:58 +0100
Subject: [PATCH 066/130] [HttpClient] fix HttpClientDataCollector when
 handling canceled responses

---
 .../HttpClient/DataCollector/HttpClientDataCollector.php        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php b/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php
index 5c3fed50c08d2..9247b7479a4e1 100644
--- a/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php
+++ b/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php
@@ -120,7 +120,7 @@ private function collectOnClient(TraceableHttpClient $client): array
                 unset($info['http_method']);
             }
 
-            if ($trace['url'] === $info['url']) {
+            if (($info['url'] ?? null) === $trace['url']) {
                 unset($info['url']);
             }
 

From 6d1657b720fd12363286cf4a857fd8052bc36486 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 11 Feb 2020 14:51:01 +0100
Subject: [PATCH 067/130] [HttpClient] fix getting response content after its
 destructor throwed an HttpExceptionInterface

---
 .../HttpClient/Response/CurlResponse.php      | 23 +++++++++----------
 .../HttpClient/Response/NativeResponse.php    | 10 ++++++--
 .../HttpClient/Response/ResponseTrait.php     |  2 ++
 .../HttpClient/Test/HttpClientTestCase.php    | 14 +++++++++++
 4 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/src/Symfony/Component/HttpClient/Response/CurlResponse.php b/src/Symfony/Component/HttpClient/Response/CurlResponse.php
index c497cfc4fdd1f..6a1be2e08a5a1 100644
--- a/src/Symfony/Component/HttpClient/Response/CurlResponse.php
+++ b/src/Symfony/Component/HttpClient/Response/CurlResponse.php
@@ -16,6 +16,7 @@
 use Symfony\Component\HttpClient\Chunk\InformationalChunk;
 use Symfony\Component\HttpClient\Exception\TransportException;
 use Symfony\Component\HttpClient\Internal\CurlClientState;
+use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
 use Symfony\Contracts\HttpClient\ResponseInterface;
 
 /**
@@ -113,7 +114,7 @@ public function __construct(CurlClientState $multi, $ch, array $options = null,
         $this->initializer = static function (self $response) {
             $waitFor = curl_getinfo($ch = $response->handle, CURLINFO_PRIVATE);
 
-            return 'H' === $waitFor[0] || 'D' === $waitFor[0];
+            return 'H' === $waitFor[0];
         };
 
         // Schedule the request in a non-blocking way
@@ -174,17 +175,15 @@ public function __destruct()
                 return; // Unused pushed response
             }
 
-            $waitFor = curl_getinfo($this->handle, CURLINFO_PRIVATE);
-
-            if ('C' === $waitFor[0] || '_' === $waitFor[0]) {
-                $this->close();
-            } elseif ('H' === $waitFor[0]) {
-                $waitFor[0] = 'D'; // D = destruct
-                curl_setopt($this->handle, CURLOPT_PRIVATE, $waitFor);
-            }
-
+            $e = null;
             $this->doDestruct();
+        } catch (HttpExceptionInterface $e) {
+            throw $e;
         } finally {
+            if (null !== $e) {
+                throw $e;
+            }
+
             $this->close();
 
             if (!$this->multi->openHandles) {
@@ -304,7 +303,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
     {
         $waitFor = @curl_getinfo($ch, CURLINFO_PRIVATE) ?: '_0';
 
-        if ('H' !== $waitFor[0] && 'D' !== $waitFor[0]) {
+        if ('H' !== $waitFor[0]) {
             return \strlen($data); // Ignore HTTP trailers
         }
 
@@ -370,7 +369,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
             // Headers and redirects completed, time to get the response's content
             $multi->handlesActivity[$id][] = new FirstChunk();
 
-            if ('D' === $waitFor[0] || 'HEAD' === $info['http_method'] || \in_array($statusCode, [204, 304], true)) {
+            if ('HEAD' === $info['http_method'] || \in_array($statusCode, [204, 304], true)) {
                 $waitFor = '_0'; // no content expected
                 $multi->handlesActivity[$id][] = null;
                 $multi->handlesActivity[$id][] = null;
diff --git a/src/Symfony/Component/HttpClient/Response/NativeResponse.php b/src/Symfony/Component/HttpClient/Response/NativeResponse.php
index 7abe18abab2e4..f7f458a47cb0c 100644
--- a/src/Symfony/Component/HttpClient/Response/NativeResponse.php
+++ b/src/Symfony/Component/HttpClient/Response/NativeResponse.php
@@ -15,6 +15,7 @@
 use Symfony\Component\HttpClient\Chunk\FirstChunk;
 use Symfony\Component\HttpClient\Exception\TransportException;
 use Symfony\Component\HttpClient\Internal\NativeClientState;
+use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
 use Symfony\Contracts\HttpClient\ResponseInterface;
 
 /**
@@ -84,11 +85,16 @@ public function getInfo(string $type = null)
 
     public function __destruct()
     {
-        $this->shouldBuffer = null;
-
         try {
+            $e = null;
             $this->doDestruct();
+        } catch (HttpExceptionInterface $e) {
+            throw $e;
         } finally {
+            if (null !== $e) {
+                throw $e;
+            }
+
             $this->close();
 
             // Clear the DNS cache when all requests completed
diff --git a/src/Symfony/Component/HttpClient/Response/ResponseTrait.php b/src/Symfony/Component/HttpClient/Response/ResponseTrait.php
index 8793a45184c61..000da5344dcfe 100644
--- a/src/Symfony/Component/HttpClient/Response/ResponseTrait.php
+++ b/src/Symfony/Component/HttpClient/Response/ResponseTrait.php
@@ -294,6 +294,8 @@ private function checkStatusCode()
      */
     private function doDestruct()
     {
+        $this->shouldBuffer = true;
+
         if ($this->initializer && null === $this->info['error']) {
             self::initialize($this);
             $this->checkStatusCode();
diff --git a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
index aad712e3e8dcd..851997c087bd3 100644
--- a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
+++ b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
@@ -782,6 +782,20 @@ public function testDestruct()
         $this->assertLessThan(4, $duration);
     }
 
+    public function testGetContentAfterDestruct()
+    {
+        $client = $this->getHttpClient(__FUNCTION__);
+
+        $start = microtime(true);
+
+        try {
+            $client->request('GET', 'http://localhost:8057/404');
+            $this->fail(ClientExceptionInterface::class.' expected');
+        } catch (ClientExceptionInterface $e) {
+            $this->assertSame('GET', $e->getResponse()->toArray(false)['REQUEST_METHOD']);
+        }
+    }
+
     public function testProxy()
     {
         $client = $this->getHttpClient(__FUNCTION__);

From d41ea2a02e49f02fb9a1436f1108c2de416af70b Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 11 Feb 2020 15:05:45 +0100
Subject: [PATCH 068/130] [HttpClient] remove useless code in test

---
 src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
index 851997c087bd3..de13686819fc6 100644
--- a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
+++ b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
@@ -786,8 +786,6 @@ public function testGetContentAfterDestruct()
     {
         $client = $this->getHttpClient(__FUNCTION__);
 
-        $start = microtime(true);
-
         try {
             $client->request('GET', 'http://localhost:8057/404');
             $this->fail(ClientExceptionInterface::class.' expected');

From 7e734a33892aeb7c5071a35f52590401a31fa045 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 11 Feb 2020 15:25:58 +0100
Subject: [PATCH 069/130] [HttpClient] fix "undefined variable"

---
 src/Symfony/Component/HttpClient/Response/CurlResponse.php   | 2 +-
 src/Symfony/Component/HttpClient/Response/NativeResponse.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Symfony/Component/HttpClient/Response/CurlResponse.php b/src/Symfony/Component/HttpClient/Response/CurlResponse.php
index 6a1be2e08a5a1..0a6597fb0852a 100644
--- a/src/Symfony/Component/HttpClient/Response/CurlResponse.php
+++ b/src/Symfony/Component/HttpClient/Response/CurlResponse.php
@@ -180,7 +180,7 @@ public function __destruct()
         } catch (HttpExceptionInterface $e) {
             throw $e;
         } finally {
-            if (null !== $e) {
+            if ($e ?? false) {
                 throw $e;
             }
 
diff --git a/src/Symfony/Component/HttpClient/Response/NativeResponse.php b/src/Symfony/Component/HttpClient/Response/NativeResponse.php
index f7f458a47cb0c..6fccfbef5a6a8 100644
--- a/src/Symfony/Component/HttpClient/Response/NativeResponse.php
+++ b/src/Symfony/Component/HttpClient/Response/NativeResponse.php
@@ -91,7 +91,7 @@ public function __destruct()
         } catch (HttpExceptionInterface $e) {
             throw $e;
         } finally {
-            if (null !== $e) {
+            if ($e ?? false) {
                 throw $e;
             }
 

From 5888566a89c71aeab8577807fd4d0bf436b2d07a Mon Sep 17 00:00:00 2001
From: Success Go 
Date: Wed, 12 Feb 2020 22:34:24 +0800
Subject: [PATCH 070/130] [HttpKernel] Fix method name in doc comments

---
 src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php b/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php
index a10741a84d1f8..a18fbd31f4949 100644
--- a/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php
+++ b/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php
@@ -21,7 +21,7 @@
  * current request. The propagation of this event is stopped as soon as a
  * response is set.
  *
- * You can also call setException() to replace the thrown exception. This
+ * You can also call setThrowable() to replace the thrown exception. This
  * exception will be thrown if no response is set during processing of this
  * event.
  *

From 707c5bade0dd7220b6d7e03dd7e27d66840edeb0 Mon Sep 17 00:00:00 2001
From: Robin Chalas 
Date: Tue, 11 Feb 2020 11:52:39 +0100
Subject: [PATCH 071/130] [Console] Don't load same-namespace alternatives on
 exact match found

---
 src/Symfony/Component/Console/Application.php | 20 ++++++++++++---
 .../Console/Tests/ApplicationTest.php         | 25 +++++++++++++++++++
 2 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php
index 1463967ffae08..280a34d5c5b1f 100644
--- a/src/Symfony/Component/Console/Application.php
+++ b/src/Symfony/Component/Console/Application.php
@@ -645,7 +645,15 @@ public function find($name)
         // filter out aliases for commands which are already on the list
         if (\count($commands) > 1) {
             $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
-            $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
+
+            if (isset($commandList[$name])) {
+                return $this->get($name);
+            }
+
+            foreach ($commands as $k => $nameOrAlias) {
+                if ($nameOrAlias === $name) {
+                    return $this->get($nameOrAlias);
+                }
                 if (!$commandList[$nameOrAlias] instanceof Command) {
                     $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
                 }
@@ -654,8 +662,14 @@ public function find($name)
 
                 $aliases[$nameOrAlias] = $commandName;
 
-                return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
-            }));
+                if ($commandName === $nameOrAlias || !\in_array($commandName, $commands)) {
+                    continue;
+                }
+
+                unset($commands[$k]);
+            }
+
+            $commands = array_unique($commands);
         }
 
         $exact = \in_array($name, $commands, true) || isset($aliases[$name]);
diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php
index 559c42599fbdd..8288cfd3269f4 100644
--- a/src/Symfony/Component/Console/Tests/ApplicationTest.php
+++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php
@@ -1642,6 +1642,31 @@ public function testAllExcludesDisabledLazyCommand()
         $this->assertArrayNotHasKey('disabled', $application->all());
     }
 
+    public function testFindAlternativesDoesNotLoadSameNamespaceCommandsOnExactMatch()
+    {
+        $application = new Application();
+        $application->setAutoExit(false);
+
+        $loaded = [];
+
+        $application->setCommandLoader(new FactoryCommandLoader([
+            'foo:bar' => function () use (&$loaded) {
+                $loaded['foo:bar'] = true;
+
+                return (new Command('foo:bar'))->setCode(function () {});
+            },
+            'foo' => function () use (&$loaded) {
+                $loaded['foo'] = true;
+
+                return (new Command('foo'))->setCode(function () {});
+            },
+        ]));
+
+        $application->run(new ArrayInput(['command' => 'foo']), new NullOutput());
+
+        $this->assertSame(['foo' => true], $loaded);
+    }
+
     protected function getDispatcher($skipCommand = false)
     {
         $dispatcher = new EventDispatcher();

From 1c8fbe1cf9d5898094c3f88e582b37d6d4eaede4 Mon Sep 17 00:00:00 2001
From: Massimiliano Arione 
Date: Thu, 13 Feb 2020 15:46:26 +0100
Subject: [PATCH 072/130] fix links to releases page (formerly known as
 "roadmap")

---
 .github/PULL_REQUEST_TEMPLATE.md                                | 2 +-
 .../Resources/views/Collector/config.html.twig                  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 57c15178547d8..859515b3ca554 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -11,7 +11,7 @@
 Replace this notice by a short README for your feature/bugfix. This will help people
 understand your PR and can be used as a start for the documentation.
 
-Additionally (see https://symfony.com/roadmap):
+Additionally (see https://symfony.com/releases):
  - Always add tests and ensure they pass.
  - Never break backward compatibility (see https://symfony.com/bc).
  - Bug fixes must be submitted against the lowest maintained branch where they apply
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
index 94912c5a71f71..58ec64d07ece9 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
@@ -202,7 +202,7 @@
                     {{ collector.symfonyeom }}
                     {{ collector.symfonyeol }}
                     
-                        View roadmap
+                        View roadmap
                     
                 
             

From 9b382590ee719a3aeaad11a91a1ff666c0da1a3a Mon Sep 17 00:00:00 2001
From: Adam Prickett 
Date: Tue, 11 Feb 2020 14:40:40 +0000
Subject: [PATCH 073/130] [Console] Handle zero row count in appendRow() for
 Table

---
 .../Component/Console/Helper/Table.php        |  4 ++-
 .../Console/Tests/Helper/TableTest.php        | 32 +++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php
index 24613bb9945ff..e4a7423a1886c 100644
--- a/src/Symfony/Component/Console/Helper/Table.php
+++ b/src/Symfony/Component/Console/Helper/Table.php
@@ -601,7 +601,9 @@ private function calculateRowCount(): int
             ++$numberOfRows; // Add row for header separator
         }
 
-        ++$numberOfRows; // Add row for footer separator
+        if (\count($this->rows) > 0) {
+            ++$numberOfRows; // Add row for footer separator
+        }
 
         return $numberOfRows;
     }
diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
index 124309dd5b02c..c4acc3fbff9c3 100644
--- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
@@ -951,6 +951,38 @@ public function testAppendRowWithoutSectionOutput()
         $table->appendRow(['9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25']);
     }
 
+    public function testSectionOutputHandlesZeroRowsAfterRender()
+    {
+        $sections = [];
+        $stream = $this->getOutputStream(true);
+        $output = new ConsoleSectionOutput($stream->getStream(), $sections, $stream->getVerbosity(), $stream->isDecorated(), new OutputFormatter());
+        $output->writeln('My Table');
+        $table = new Table($output);
+        $table
+            ->setHeaders(['ISBN', 'Title', 'Author', 'Price'])
+            ->setRows([]);
+
+        $table->render();
+
+        $table->appendRow(['9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25']);
+
+        $expected =
+            <<assertEquals($expected, $this->getOutputContent($output));
+    }
+
     public function testIsNotDefinedStyleException()
     {
         $this->expectException('Symfony\Component\Console\Exception\InvalidArgumentException');

From 5825e3c58c1b047606ea4c8526b7d93ded2f9a4e Mon Sep 17 00:00:00 2001
From: Massimiliano Arione 
Date: Thu, 13 Feb 2020 16:21:59 +0100
Subject: [PATCH 074/130] fix anchor

---
 .../Resources/views/Collector/config.html.twig                  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
index 58ec64d07ece9..b9d130b13e718 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
@@ -202,7 +202,7 @@
                     

From 67ef532f8cfbc2678fd7ea862e80d95725935897 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Thu, 13 Feb 2020 19:40:02 +0100
Subject: [PATCH 075/130] [ErrorHandler] silence warning when
 zend.assertions=-1

---
 src/Symfony/Component/ErrorHandler/Debug.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/ErrorHandler/Debug.php b/src/Symfony/Component/ErrorHandler/Debug.php
index a3c0511d220e8..9cc8ec17a8270 100644
--- a/src/Symfony/Component/ErrorHandler/Debug.php
+++ b/src/Symfony/Component/ErrorHandler/Debug.php
@@ -29,7 +29,7 @@ public static function enable(): ErrorHandler
             ini_set('display_errors', 1);
         }
 
-        ini_set('zend.assertions', 1);
+        @ini_set('zend.assertions', 1);
         ini_set('assert.active', 1);
         ini_set('assert.warning', 0);
         ini_set('assert.exception', 1);

From 06f5a1113d3188e2abc43021ada4eb7bd82376ef Mon Sep 17 00:00:00 2001
From: Tobias Schultze 
Date: Thu, 13 Feb 2020 19:35:54 +0100
Subject: [PATCH 076/130] [HttpFoundation] fix not sending Content-Type header
 for 204 responses

---
 src/Symfony/Component/HttpFoundation/Response.php    |  4 +++-
 .../Component/HttpFoundation/Tests/ResponseTest.php  | 12 ++----------
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php
index 05f740b6ad425..b267cd8ceb57b 100644
--- a/src/Symfony/Component/HttpFoundation/Response.php
+++ b/src/Symfony/Component/HttpFoundation/Response.php
@@ -267,10 +267,12 @@ public function prepare(Request $request)
             $this->setContent(null);
             $headers->remove('Content-Type');
             $headers->remove('Content-Length');
+            // prevent PHP from sending the Content-Type header based on default_mimetype
+            ini_set('default_mimetype', '');
         } else {
             // Content-type based on the Request
             if (!$headers->has('Content-Type')) {
-                $format = $request->getPreferredFormat();
+                $format = $request->getPreferredFormat(null);
                 if (null !== $format && $mimeType = $request->getMimeType($format)) {
                     $headers->set('Content-Type', $mimeType);
                 }
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
index a2a5574f284a0..d5da59ad7e803 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
@@ -461,18 +461,10 @@ public function testSetVary()
 
     public function testDefaultContentType()
     {
-        $headerMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->setMethods(['set'])->getMock();
-        $headerMock->expects($this->at(0))
-            ->method('set')
-            ->with('Content-Type', 'text/html');
-        $headerMock->expects($this->at(1))
-            ->method('set')
-            ->with('Content-Type', 'text/html; charset=UTF-8');
-
         $response = new Response('foo');
-        $response->headers = $headerMock;
-
         $response->prepare(new Request());
+
+        $this->assertSame('text/html; charset=UTF-8', $response->headers->get('Content-Type'));
     }
 
     public function testContentTypeCharset()

From e1713862997b29dd91f7203da0db6d4ef38355d6 Mon Sep 17 00:00:00 2001
From: Christian Flothmann 
Date: Fri, 14 Feb 2020 07:56:04 +0100
Subject: [PATCH 077/130] sync validator translation files with master

---
 .../Validator/Resources/translations/validators.de.xlf        | 4 ++++
 .../Validator/Resources/translations/validators.en.xlf        | 4 ++++
 .../Validator/Resources/translations/validators.fr.xlf        | 4 ++++
 .../Validator/Resources/translations/validators.ru.xlf        | 4 ++++
 4 files changed, 16 insertions(+)

diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf
index 8ee3120482267..0702e8dfcdb1e 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf
@@ -366,6 +366,10 @@
                 This value should be between {{ min }} and {{ max }}.
                 Dieser Wert sollte zwischen {{ min }} und {{ max }} sein.
             
+            
+                This value is not a valid hostname.
+                Dieser Wert ist kein gültiger Hostname.
+            
         
     
 
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf
index 100d552076f2c..635e6736f6941 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf
@@ -366,6 +366,10 @@
                 This value should be between {{ min }} and {{ max }}.
                 This value should be between {{ min }} and {{ max }}.
             
+            
+                This value is not a valid hostname.
+                This value is not a valid hostname.
+            
         
     
 
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf
index dc7e73e3c7581..4a7ab3538c41a 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf
@@ -366,6 +366,10 @@
                 This value should be between {{ min }} and {{ max }}.
                 Cette valeur doit être comprise entre {{ min }} et {{ max }}.
             
+            
+                This value is not a valid hostname.
+                Cette valeur n'est pas un nom d'hôte valide.
+            
         
     
 
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf
index 361be20f796f8..80911a9902910 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf
@@ -366,6 +366,10 @@
                 This value should be between {{ min }} and {{ max }}.
                 Значение должно быть между {{ min }} и {{ max }}.
             
+            
+                This value is not a valid hostname.
+                Значение не является корректным именем хоста.
+            
         
     
 

From 9e431038b204c6ebe53b2d628c0df52df086bd4a Mon Sep 17 00:00:00 2001
From: Christopher Hertel 
Date: Wed, 12 Feb 2020 22:21:47 +0100
Subject: [PATCH 078/130] fix unix root dir issue

---
 src/Symfony/Component/Finder/Finder.php                     | 4 ++++
 .../Finder/Iterator/RecursiveDirectoryIterator.php          | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php
index d2ea17d87a00f..33a76cc976f86 100644
--- a/src/Symfony/Component/Finder/Finder.php
+++ b/src/Symfony/Component/Finder/Finder.php
@@ -744,6 +744,10 @@ private function searchInDirectory($dir)
      */
     private function normalizeDir($dir)
     {
+        if ('/' === $dir) {
+            return $dir;
+        }
+
         $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
 
         if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {
diff --git a/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php b/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php
index ab48a2b8a174d..63764d407d30f 100644
--- a/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php
+++ b/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php
@@ -74,7 +74,11 @@ public function current()
         }
         $subPathname .= $this->getFilename();
 
-        return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
+        if ('/' !== $basePath = $this->rootPath) {
+            $basePath .= $this->directorySeparator;
+        }
+
+        return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
     }
 
     /**

From 618cd80b0d9106472e6ee746fe1580c2f1161686 Mon Sep 17 00:00:00 2001
From: Andreas Schempp 
Date: Fri, 14 Feb 2020 09:25:43 +0100
Subject: [PATCH 079/130] Correctly remove trace level options for HttpCache

---
 src/Symfony/Component/HttpClient/CachingHttpClient.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/Symfony/Component/HttpClient/CachingHttpClient.php b/src/Symfony/Component/HttpClient/CachingHttpClient.php
index 367140485f8ae..a6af1b5f2d5f1 100644
--- a/src/Symfony/Component/HttpClient/CachingHttpClient.php
+++ b/src/Symfony/Component/HttpClient/CachingHttpClient.php
@@ -55,6 +55,8 @@ public function __construct(HttpClientInterface $client, StoreInterface $store,
         unset($defaultOptions['allow_revalidate']);
         unset($defaultOptions['stale_while_revalidate']);
         unset($defaultOptions['stale_if_error']);
+        unset($defaultOptions['trace_level']);
+        unset($defaultOptions['trace_header']);
 
         if ($defaultOptions) {
             [, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions);

From 8f2fbf6e2c52f794c8c7178bd6cf90fd9f075f51 Mon Sep 17 00:00:00 2001
From: Denis Brumann 
Date: Fri, 14 Feb 2020 09:11:12 +0100
Subject: [PATCH 080/130] Fixes typo in error message.

---
 src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php b/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php
index 93fe767062713..7224c5f34a219 100644
--- a/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php
+++ b/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php
@@ -37,7 +37,7 @@ class TwigErrorRenderer implements ErrorRendererInterface
     public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorRenderer = null, $debug = false)
     {
         if (!\is_bool($debug) && !\is_callable($debug)) {
-            throw new \TypeError(sprintf('Argument 2 passed to %s() must be a boolean or a callable, %s given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
+            throw new \TypeError(sprintf('Argument 3 passed to %s() must be a boolean or a callable, %s given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
         }
 
         $this->twig = $twig;

From 3f995ac602d42ef036491e43157239ccb0ec351d Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Fri, 14 Feb 2020 11:01:23 +0100
Subject: [PATCH 081/130] [HttpKernel] fix registering DebugHandlersListener
 regardless of the PHP_SAPI

---
 .../HttpKernel/EventListener/DebugHandlersListener.php       | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php
index df9df09c0bc32..957a3cdb0f4c4 100644
--- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php
+++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php
@@ -65,6 +65,9 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $
      */
     public function configure(Event $event = null)
     {
+        if ($event instanceof ConsoleEvent && !\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
+            return;
+        }
         if (!$event instanceof KernelEvent ? !$this->firstCall : !$event->isMasterRequest()) {
             return;
         }
@@ -148,7 +151,7 @@ public static function getSubscribedEvents()
     {
         $events = [KernelEvents::REQUEST => ['configure', 2048]];
 
-        if ('cli' === \PHP_SAPI && \defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) {
+        if (\defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) {
             $events[ConsoleEvents::COMMAND] = ['configure', 2048];
         }
 

From f9659719198f278943dd5401e8a260dd840f86c2 Mon Sep 17 00:00:00 2001
From: Makdessi Alex 
Date: Thu, 13 Feb 2020 15:34:42 +0100
Subject: [PATCH 082/130] [VarDumper] fixed DateCaster not displaying
 additional fields

---
 .../Component/VarDumper/Caster/DateCaster.php |  6 ++-
 .../VarDumper/Tests/Caster/DateCasterTest.php | 37 ++++++++++++++++++-
 .../Tests/Fixtures/DateTimeChild.php          |  8 ++++
 3 files changed, 49 insertions(+), 2 deletions(-)
 create mode 100644 src/Symfony/Component/VarDumper/Tests/Fixtures/DateTimeChild.php

diff --git a/src/Symfony/Component/VarDumper/Caster/DateCaster.php b/src/Symfony/Component/VarDumper/Caster/DateCaster.php
index f3258b19a6f28..70f229a0d8b7d 100644
--- a/src/Symfony/Component/VarDumper/Caster/DateCaster.php
+++ b/src/Symfony/Component/VarDumper/Caster/DateCaster.php
@@ -31,7 +31,11 @@ public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub,
             .($location ? ($d->format('I') ? "\nDST On" : "\nDST Off") : '')
         ;
 
-        $a = [];
+        unset(
+            $a[Caster::PREFIX_DYNAMIC.'date'],
+            $a[Caster::PREFIX_DYNAMIC.'timezone'],
+            $a[Caster::PREFIX_DYNAMIC.'timezone_type']
+        );
         $a[$prefix.'date'] = new ConstStub(self::formatDateTime($d, $location ? ' e (P)' : ' P'), $title);
 
         $stub->class .= $d->format(' @U');
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php
index da8b4d0fa5c38..87485448dcc90 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php
@@ -16,6 +16,7 @@
 use Symfony\Component\VarDumper\Caster\DateCaster;
 use Symfony\Component\VarDumper\Cloner\Stub;
 use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
+use Symfony\Component\VarDumper\Tests\Fixtures\DateTimeChild;
 
 /**
  * @author Dany Maillard 
@@ -55,7 +56,7 @@ public function testCastDateTime($time, $timezone, $xDate, $xTimestamp, $xInfos)
 
         $stub = new Stub();
         $date = new \DateTime($time, new \DateTimeZone($timezone));
-        $cast = DateCaster::castDateTime($date, ['foo' => 'bar'], $stub, false, 0);
+        $cast = DateCaster::castDateTime($date, Caster::castObject($date, \DateTime::class), $stub, false, 0);
 
         $xDump = << "foo"
+  "\\x00~\\x00date" => $xDate
+]
+EODUMP;
+
+        $this->assertDumpEquals($xDump, $dateCast);
+
+        $xDump = <<assertDumpMatchesFormat($xDump, $dateCast["\0~\0date"]);
+    }
+
     /**
      * @dataProvider provideIntervals
      */
diff --git a/src/Symfony/Component/VarDumper/Tests/Fixtures/DateTimeChild.php b/src/Symfony/Component/VarDumper/Tests/Fixtures/DateTimeChild.php
new file mode 100644
index 0000000000000..2ea2df6514ae0
--- /dev/null
+++ b/src/Symfony/Component/VarDumper/Tests/Fixtures/DateTimeChild.php
@@ -0,0 +1,8 @@
+
Date: Fri, 14 Feb 2020 19:15:20 +0100
Subject: [PATCH 083/130] Add missing autoload calls

Until either php 7.4 or doctrine/persistence 2 is required, these will
be needed to make sure php recognises signatures using the old names as
compatible with signatures using the new names.
This is necessary for types defined outside Symfony that extend types
from Symfony and still use the old names in signatures of methods they
override.

More details at https://dev.to/greg0ire/how-to-deprecate-a-type-in-php-48cf

Fixes https://github.com/doctrine/DoctrineMongoDBBundle/issues/616
---
 src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php         | 2 ++
 src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php           | 2 ++
 .../Bridge/Doctrine/Security/User/EntityUserProvider.php       | 3 +++
 3 files changed, 7 insertions(+)

diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
index c32a60b254cd6..97f5facf62e74 100644
--- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
+++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
@@ -282,3 +282,5 @@ public function reset()
         $this->choiceLoaders = [];
     }
 }
+
+interface_exists(ObjectManager::class);
diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
index 72fab88d44b9c..e462d5692ca77 100644
--- a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
+++ b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
@@ -97,3 +97,5 @@ private function parameterToArray(Parameter $parameter): array
         return [$parameter->getName(), $parameter->getType(), $parameter->getValue()];
     }
 }
+
+interface_exists(ObjectManager::class);
diff --git a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
index cdcdbb8febf98..69bbe66965cd0 100644
--- a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
+++ b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
@@ -153,3 +153,6 @@ private function getClassMetadata(): ClassMetadata
         return $this->getObjectManager()->getClassMetadata($this->classOrAlias);
     }
 }
+
+interface_exists(ObjectManager::class);
+interface_exists(ObjectRepository::class);

From 87d51c1e4bb3f121b86355df846c6abb8f004b85 Mon Sep 17 00:00:00 2001
From: Daniel Gorgan 
Date: Fri, 14 Feb 2020 17:15:50 +0200
Subject: [PATCH 084/130] Set previous exception when rethrown from controller
 resolver

---
 .../Component/HttpKernel/Controller/ControllerResolver.php      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php
index c981642fee4f0..619628b5c7a98 100644
--- a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php
+++ b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php
@@ -88,7 +88,7 @@ public function getController(Request $request)
         try {
             $callable = $this->createController($controller);
         } catch (\InvalidArgumentException $e) {
-            throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $e->getMessage()));
+            throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $e->getMessage()), 0, $e);
         }
 
         return $callable;

From e13470c823ad8032167aa8cbf905eaaed087ebf9 Mon Sep 17 00:00:00 2001
From: Robin Chalas 
Date: Sat, 15 Feb 2020 14:27:16 +0100
Subject: [PATCH 085/130] [Console] Inline exact-match handling with 4.4

---
 src/Symfony/Component/Console/Application.php | 24 ++++++-------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php
index 280a34d5c5b1f..b5637277e88da 100644
--- a/src/Symfony/Component/Console/Application.php
+++ b/src/Symfony/Component/Console/Application.php
@@ -608,6 +608,10 @@ public function find($name)
             }
         }
 
+        if ($this->has($name)) {
+            return $this->get($name);
+        }
+
         $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
         $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
         $commands = preg_grep('{^'.$expr.'}', $allCommands);
@@ -645,15 +649,7 @@ public function find($name)
         // filter out aliases for commands which are already on the list
         if (\count($commands) > 1) {
             $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
-
-            if (isset($commandList[$name])) {
-                return $this->get($name);
-            }
-
-            foreach ($commands as $k => $nameOrAlias) {
-                if ($nameOrAlias === $name) {
-                    return $this->get($nameOrAlias);
-                }
+            $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
                 if (!$commandList[$nameOrAlias] instanceof Command) {
                     $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
                 }
@@ -662,14 +658,8 @@ public function find($name)
 
                 $aliases[$nameOrAlias] = $commandName;
 
-                if ($commandName === $nameOrAlias || !\in_array($commandName, $commands)) {
-                    continue;
-                }
-
-                unset($commands[$k]);
-            }
-
-            $commands = array_unique($commands);
+                return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
+            }));
         }
 
         $exact = \in_array($name, $commands, true) || isset($aliases[$name]);

From 50d744589ea2ee6bf01e82a6d3933641e54a66fa Mon Sep 17 00:00:00 2001
From: Mathias Arlaud 
Date: Sat, 15 Feb 2020 15:50:41 +0100
Subject: [PATCH 086/130] [Routing] Add locale requirement for localized routes

---
 .../Component/Routing/Loader/AnnotationClassLoader.php |  2 ++
 .../Routing/Loader/Configurator/Traits/AddTrait.php    |  2 ++
 src/Symfony/Component/Routing/Loader/XmlFileLoader.php |  2 ++
 .../Component/Routing/Loader/YamlFileLoader.php        |  2 ++
 .../Routing/Tests/Loader/AnnotationClassLoaderTest.php |  3 +++
 .../Routing/Tests/Loader/PhpFileLoaderTest.php         | 10 +++++-----
 .../Routing/Tests/Loader/XmlFileLoaderTest.php         |  3 +++
 .../Routing/Tests/Loader/YamlFileLoaderTest.php        |  3 +++
 8 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
index 6390a79f58118..ce61032ac341d 100644
--- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
+++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
@@ -18,6 +18,7 @@
 use Symfony\Component\Routing\Annotation\Route as RouteAnnotation;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
+use Symfony\Component\Routing\RouteCompiler;
 
 /**
  * AnnotationClassLoader loads routing information from a PHP class and its methods.
@@ -211,6 +212,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
             $this->configureRoute($route, $class, $method, $annot);
             if (0 !== $locale) {
                 $route->setDefault('_locale', $locale);
+                $route->setRequirement('_locale', preg_quote($locale, RouteCompiler::REGEX_DELIMITER));
                 $route->setDefault('_canonical_route', $name);
                 $collection->add($name.'.'.$locale, $route);
             } else {
diff --git a/src/Symfony/Component/Routing/Loader/Configurator/Traits/AddTrait.php b/src/Symfony/Component/Routing/Loader/Configurator/Traits/AddTrait.php
index 085fde4bc9f4c..84899aa2e27fc 100644
--- a/src/Symfony/Component/Routing/Loader/Configurator/Traits/AddTrait.php
+++ b/src/Symfony/Component/Routing/Loader/Configurator/Traits/AddTrait.php
@@ -15,6 +15,7 @@
 use Symfony\Component\Routing\Loader\Configurator\RouteConfigurator;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
+use Symfony\Component\Routing\RouteCompiler;
 
 trait AddTrait
 {
@@ -67,6 +68,7 @@ final public function add(string $name, $path): RouteConfigurator
             $routes->add($name.'.'.$locale, $route = $this->createRoute($path));
             $this->collection->add($this->name.$name.'.'.$locale, $route);
             $route->setDefault('_locale', $locale);
+            $route->setRequirement('_locale', preg_quote($locale, RouteCompiler::REGEX_DELIMITER));
             $route->setDefault('_canonical_route', $this->name.$name);
         }
 
diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php
index dc208f28e16c3..da8f34b293c19 100644
--- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php
+++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php
@@ -16,6 +16,7 @@
 use Symfony\Component\Config\Util\XmlUtils;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
+use Symfony\Component\Routing\RouteCompiler;
 
 /**
  * XmlFileLoader loads XML routing files.
@@ -129,6 +130,7 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, $p
             foreach ($paths as $locale => $p) {
                 $defaults['_locale'] = $locale;
                 $defaults['_canonical_route'] = $id;
+                $requirements['_locale'] = preg_quote($locale, RouteCompiler::REGEX_DELIMITER);
                 $route = new Route($p, $defaults, $requirements, $options, $node->getAttribute('host'), $schemes, $methods, $condition);
                 $collection->add($id.'.'.$locale, $route);
             }
diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php
index 0de36c93b2e5e..868da9bd30b4b 100644
--- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php
+++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php
@@ -15,6 +15,7 @@
 use Symfony\Component\Config\Resource\FileResource;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
+use Symfony\Component\Routing\RouteCompiler;
 use Symfony\Component\Yaml\Exception\ParseException;
 use Symfony\Component\Yaml\Parser as YamlParser;
 use Symfony\Component\Yaml\Yaml;
@@ -140,6 +141,7 @@ protected function parseRoute(RouteCollection $collection, $name, array $config,
             foreach ($config['path'] as $locale => $path) {
                 $localizedRoute = clone $route;
                 $localizedRoute->setDefault('_locale', $locale);
+                $localizedRoute->setRequirement('_locale', preg_quote($locale, RouteCompiler::REGEX_DELIMITER));
                 $localizedRoute->setDefault('_canonical_route', $name);
                 $localizedRoute->setPath($path);
                 $collection->add($name.'.'.$locale, $localizedRoute);
diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
index 4419007751146..c8794e10b6741 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
@@ -125,6 +125,9 @@ public function testLocalizedPathRoutes()
         $this->assertCount(2, $routes);
         $this->assertEquals('/path', $routes->get('action.en')->getPath());
         $this->assertEquals('/pad', $routes->get('action.nl')->getPath());
+
+        $this->assertEquals('nl', $routes->get('action.nl')->getRequirement('_locale'));
+        $this->assertEquals('en', $routes->get('action.en')->getRequirement('_locale'));
     }
 
     public function testLocalizedPathRoutesWithExplicitPathPropety()
diff --git a/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php
index 71f9df15470a1..789848c66021a 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php
@@ -229,11 +229,11 @@ public function testRoutingI18nConfigurator()
 
         $expectedCollection = new RouteCollection();
 
-        $expectedCollection->add('foo.en', (new Route('/glish/foo'))->setDefaults(['_locale' => 'en', '_canonical_route' => 'foo']));
-        $expectedCollection->add('bar.en', (new Route('/glish/bar'))->setDefaults(['_locale' => 'en', '_canonical_route' => 'bar']));
-        $expectedCollection->add('baz.en', (new Route('/baz'))->setDefaults(['_locale' => 'en', '_canonical_route' => 'baz']));
-        $expectedCollection->add('c_foo.fr', (new Route('/ench/pub/foo'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'c_foo']));
-        $expectedCollection->add('c_bar.fr', (new Route('/ench/pub/bar'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'c_bar']));
+        $expectedCollection->add('foo.en', (new Route('/glish/foo'))->setDefaults(['_locale' => 'en', '_canonical_route' => 'foo'])->setRequirement('_locale', 'en'));
+        $expectedCollection->add('bar.en', (new Route('/glish/bar'))->setDefaults(['_locale' => 'en', '_canonical_route' => 'bar'])->setRequirement('_locale', 'en'));
+        $expectedCollection->add('baz.en', (new Route('/baz'))->setDefaults(['_locale' => 'en', '_canonical_route' => 'baz'])->setRequirement('_locale', 'en'));
+        $expectedCollection->add('c_foo.fr', (new Route('/ench/pub/foo'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'c_foo'])->setRequirement('_locale', 'fr'));
+        $expectedCollection->add('c_bar.fr', (new Route('/ench/pub/bar'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'c_bar'])->setRequirement('_locale', 'fr'));
 
         $expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl_sub_i18n.php')));
         $expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl_i18n.php')));
diff --git a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
index e27149f93125c..66d54fc985c4c 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
@@ -185,6 +185,9 @@ public function testLocalizedImports()
 
         $this->assertEquals('/le-prefix/le-suffix', $routeCollection->get('imported.fr')->getPath());
         $this->assertEquals('/the-prefix/suffix', $routeCollection->get('imported.en')->getPath());
+
+        $this->assertEquals('fr', $routeCollection->get('imported.fr')->getRequirement('_locale'));
+        $this->assertEquals('en', $routeCollection->get('imported.en')->getRequirement('_locale'));
     }
 
     public function testLocalizedImportsOfNotLocalizedRoutes()
diff --git a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
index caad0aa978ea6..52c21c287fcf6 100644
--- a/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php
@@ -321,6 +321,9 @@ public function testImportingRoutesWithLocales()
         $this->assertCount(2, $routes);
         $this->assertEquals('/nl/voorbeeld', $routes->get('imported.nl')->getPath());
         $this->assertEquals('/en/example', $routes->get('imported.en')->getPath());
+
+        $this->assertEquals('nl', $routes->get('imported.nl')->getRequirement('_locale'));
+        $this->assertEquals('en', $routes->get('imported.en')->getRequirement('_locale'));
     }
 
     public function testImportingNonLocalizedRoutesWithLocales()

From 771c642a43fcfe72f0b333d006a890634dcbef2b Mon Sep 17 00:00:00 2001
From: Benjamin 
Date: Mon, 17 Feb 2020 09:30:34 +0100
Subject: [PATCH 087/130] [PhpUnitBridge] Add compatibility to PHPUnit 9 #35662

---
 .../Bridge/PhpUnit/Legacy/CommandForV9.php    | 63 +++++++++++++++++++
 src/Symfony/Bridge/PhpUnit/TextUI/Command.php |  4 +-
 2 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 src/Symfony/Bridge/PhpUnit/Legacy/CommandForV9.php

diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/CommandForV9.php b/src/Symfony/Bridge/PhpUnit/Legacy/CommandForV9.php
new file mode 100644
index 0000000000000..aa48ca5f2487a
--- /dev/null
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/CommandForV9.php
@@ -0,0 +1,63 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\PhpUnit\Legacy;
+
+use PHPUnit\TextUI\Command as BaseCommand;
+use PHPUnit\TextUI\Configuration\Configuration;
+use PHPUnit\TextUI\Configuration\Registry;
+use PHPUnit\TextUI\TestRunner as BaseRunner;
+use Symfony\Bridge\PhpUnit\SymfonyTestsListener;
+
+/**
+ * {@inheritdoc}
+ *
+ * @internal
+ */
+class CommandForV9 extends BaseCommand
+{
+    /**
+     * {@inheritdoc}
+     */
+    protected function createRunner(): BaseRunner
+    {
+        $this->arguments['listeners'] = isset($this->arguments['listeners']) ? $this->arguments['listeners'] : [];
+
+        $registeredLocally = false;
+
+        foreach ($this->arguments['listeners'] as $registeredListener) {
+            if ($registeredListener instanceof SymfonyTestsListener) {
+                $registeredListener->globalListenerDisabled();
+                $registeredLocally = true;
+                break;
+            }
+        }
+
+        if (isset($this->arguments['configuration'])) {
+            $configuration = $this->arguments['configuration'];
+            if (!$configuration instanceof Configuration) {
+                $configuration = Registry::getInstance()->get($this->arguments['configuration']);
+            }
+            foreach ($configuration->listeners() as $registeredListener) {
+                if ('Symfony\Bridge\PhpUnit\SymfonyTestsListener' === ltrim($registeredListener->className(), '\\')) {
+                    $registeredLocally = true;
+                    break;
+                }
+            }
+        }
+
+        if (!$registeredLocally) {
+            $this->arguments['listeners'][] = new SymfonyTestsListener();
+        }
+
+        return parent::createRunner();
+    }
+}
diff --git a/src/Symfony/Bridge/PhpUnit/TextUI/Command.php b/src/Symfony/Bridge/PhpUnit/TextUI/Command.php
index be73e4d2beb5a..8690812b56b57 100644
--- a/src/Symfony/Bridge/PhpUnit/TextUI/Command.php
+++ b/src/Symfony/Bridge/PhpUnit/TextUI/Command.php
@@ -13,8 +13,10 @@
 
 if (version_compare(\PHPUnit\Runner\Version::id(), '6.0.0', '<')) {
     class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV5', 'Symfony\Bridge\PhpUnit\TextUI\Command');
-} else {
+} elseif (version_compare(\PHPUnit\Runner\Version::id(), '9.0.0', '<')) {
     class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV6', 'Symfony\Bridge\PhpUnit\TextUI\Command');
+} else {
+    class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV9', 'Symfony\Bridge\PhpUnit\TextUI\Command');
 }
 
 if (false) {

From 8c4de564a8697cf63c49c39501060ffb138f4762 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Przemys=C5=82aw=20Bogusz?= 
Date: Sun, 16 Feb 2020 16:22:50 +0100
Subject: [PATCH 088/130] [Validator] Add the missing translations for the
 Polish ("pl") locale

---
 .../Resources/translations/validators.pl.xlf  | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf
index f1910c99d5751..d1dd1471a77ca 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf
@@ -330,10 +330,46 @@
                 This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.
                 Ten kod BIC (Business Identifier Code) nie jest powiązany z międzynarodowym numerem rachunku bankowego (IBAN) {{ iban }}.
             
+            
+                This value should be valid JSON.
+                Ta wartość powinna być prawidłowym formatem JSON.
+            
+            
+                This collection should contain only unique elements.
+                Ten zbiór powinien zawierać tylko unikalne elementy.
+            
+            
+                This value should be positive.
+                Ta wartość powinna być dodatnia.
+            
+            
+                This value should be either positive or zero.
+                Ta wartość powinna być dodatnia lub równa zero.
+            
+            
+                This value should be negative.
+                Ta wartość powinna być ujemna.
+            
+            
+                This value should be either negative or zero.
+                Ta wartość powinna być ujemna lub równa zero.
+            
+            
+                This value is not a valid timezone.
+                Ta wartość nie jest prawidłową strefą czasową.
+            
+            
+                This password has been leaked in a data breach, it must not be used. Please use another password.
+                To hasło wyciekło w wyniku naruszenia danych i nie może być użyte. Proszę użyć innego hasła.
+            
             
                 This value should be between {{ min }} and {{ max }}.
                 Ta wartość powinna być pomiędzy {{ min }} a {{ max }}.
             
+            
+                This value is not a valid hostname.
+                Ta wartość nie jest prawidłową nazwą hosta.
+            
         
     
 

From dc11c8d1b8764639ed7d382ff3dfdf6c4011f63a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20K=C3=A4fer?= 
Date: Sun, 16 Feb 2020 17:40:22 +0100
Subject: [PATCH 089/130] Docs: Typo, grammar

---
 .../Component/Security/Core/User/UserInterface.php        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Symfony/Component/Security/Core/User/UserInterface.php b/src/Symfony/Component/Security/Core/User/UserInterface.php
index 58f6cfb3bb146..fdad6b055b32d 100644
--- a/src/Symfony/Component/Security/Core/User/UserInterface.php
+++ b/src/Symfony/Component/Security/Core/User/UserInterface.php
@@ -21,10 +21,10 @@
  * password (for checking against a submitted password), assigning roles
  * and so on.
  *
- * Regardless of how your user are loaded or where they come from (a database,
- * configuration, web service, etc), you will have a class that implements
- * this interface. Objects that implement this interface are created and
- * loaded by different objects that implement UserProviderInterface
+ * Regardless of how your users are loaded or where they come from (a database,
+ * configuration, web service, etc.), you will have a class that implements
+ * this interface. Objects that implement this interface are created and 
+ * loaded by different objects that implement UserProviderInterface.
  *
  * @see UserProviderInterface
  * @see AdvancedUserInterface

From 2f65a7a2556b09cbee7e7afb64b4bb432eaa5a7e Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 18 Feb 2020 12:08:29 +0100
Subject: [PATCH 090/130] [Config] don't throw on missing excluded paths

---
 .../Component/DependencyInjection/Loader/FileLoader.php    | 2 +-
 .../DependencyInjection/Tests/Loader/FileLoaderTest.php    | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php
index 77cad3c046d73..0a800f01c3f71 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php
@@ -110,7 +110,7 @@ private function findClasses($namespace, $pattern, $excludePattern)
         $excludePrefix = null;
         if ($excludePattern) {
             $excludePattern = $parameterBag->unescapeValue($parameterBag->resolveValue($excludePattern));
-            foreach ($this->glob($excludePattern, true, $resource) as $path => $info) {
+            foreach ($this->glob($excludePattern, true, $resource, true) as $path => $info) {
                 if (null === $excludePrefix) {
                     $excludePrefix = $resource->getPrefix();
                 }
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
index ffe58a67ef3bb..cbcc6995170cd 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
@@ -134,6 +134,13 @@ public function testRegisterClassesWithExclude()
             ],
             array_keys($container->getAliases())
         );
+
+        $loader->registerClasses(
+            new Definition(),
+            'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\\',
+            'Prototype/*',
+            'Prototype/NotExistingDir'
+        );
     }
 
     public function testNestedRegisterClasses()

From ab4123ce68eb94b328e8988cb7416138fb0cbae8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Sch=C3=A4dlich?= 
Date: Tue, 18 Feb 2020 11:54:21 +0100
Subject: [PATCH 091/130] [Notifier] Remove not needed argument $bus in
 BrowserChannel::notify()

---
 src/Symfony/Component/Notifier/Channel/BrowserChannel.php | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/Symfony/Component/Notifier/Channel/BrowserChannel.php b/src/Symfony/Component/Notifier/Channel/BrowserChannel.php
index bd6bb29660740..c0f6dbc7bf346 100644
--- a/src/Symfony/Component/Notifier/Channel/BrowserChannel.php
+++ b/src/Symfony/Component/Notifier/Channel/BrowserChannel.php
@@ -12,7 +12,6 @@
 namespace Symfony\Component\Notifier\Channel;
 
 use Symfony\Component\HttpFoundation\RequestStack;
-use Symfony\Component\Messenger\MessageBusInterface;
 use Symfony\Component\Notifier\Notification\Notification;
 use Symfony\Component\Notifier\Recipient\Recipient;
 
@@ -30,7 +29,7 @@ public function __construct(RequestStack $stack)
         $this->stack = $stack;
     }
 
-    public function notify(Notification $notification, Recipient $recipient, string $transportName = null, MessageBusInterface $bus = null): void
+    public function notify(Notification $notification, Recipient $recipient, string $transportName = null): void
     {
         if (null === $request = $this->stack->getCurrentRequest()) {
             return;

From 63f9e013a1f43b024f2dc73235f41f5076103b3d Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 18 Feb 2020 14:07:02 +0100
Subject: [PATCH 092/130] [Ldap] force default network timeout

---
 src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php
index 3ff790d05181f..2dcb215b921a4 100644
--- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php
+++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php
@@ -107,6 +107,10 @@ protected function configureOptions(OptionsResolver $resolver)
                 $value['referrals'] = $options['referrals'];
             }
 
+            if (!isset($value['network_timeout'])) {
+                $value['network_timeout'] = ini_get('default_socket_timeout');
+            }
+
             return $value;
         });
 

From 1c24ccc6352eba5e81d75d2c8dac01d284ef418d Mon Sep 17 00:00:00 2001
From: Robin Chalas 
Date: Tue, 18 Feb 2020 22:48:57 +0100
Subject: [PATCH 093/130] fix typo

---
 .../Security/Guard/Provider/GuardAuthenticationProvider.php     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php b/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php
index 26890db367385..ddc8c5029778a 100644
--- a/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php
+++ b/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php
@@ -82,7 +82,7 @@ public function authenticate(TokenInterface $token)
                 return $token;
             }
 
-            // this AccountExpiredException causes the user to be logged out
+            // this causes the user to be logged out
             throw new AuthenticationExpiredException();
         }
 

From 094e4bbbc2ba86bb4f2e12aefaf522e0c48ddaf8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= 
Date: Wed, 19 Feb 2020 15:48:16 +0100
Subject: [PATCH 094/130] Do not rely on the current locale when dumping a
 Graphviz object

Funny bug !

With `de_DE.UTF-8` as locale:
```
php > echo sprintf('%s', 0.5);
0,5
php > echo sprintf('%d', 0.5);
0
php > echo sprintf('%f', 0.5);
0,500000
php > echo (string) 0.5;
0,5
```

So now we force `'0.5'`
---
 .../Component/DependencyInjection/Dumper/GraphvizDumper.php  | 5 +++--
 src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php     | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
index f06e6e80d5031..0591e024f5753 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
@@ -32,10 +32,11 @@ class GraphvizDumper extends Dumper
 {
     private $nodes;
     private $edges;
+    // All values should be strings
     private $options = [
             'graph' => ['ratio' => 'compress'],
-            'node' => ['fontsize' => 11, 'fontname' => 'Arial', 'shape' => 'record'],
-            'edge' => ['fontsize' => 9, 'fontname' => 'Arial', 'color' => 'grey', 'arrowhead' => 'open', 'arrowsize' => 0.5],
+            'node' => ['fontsize' => '11', 'fontname' => 'Arial', 'shape' => 'record'],
+            'edge' => ['fontsize' => '9', 'fontname' => 'Arial', 'color' => 'grey', 'arrowhead' => 'open', 'arrowsize' => '0.5'],
             'node.instance' => ['fillcolor' => '#9999ff', 'style' => 'filled'],
             'node.definition' => ['fillcolor' => '#eeeeee'],
             'node.missing' => ['fillcolor' => '#ff9999', 'style' => 'filled'],
diff --git a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php
index c3d673fa91e58..0f6cb33082936 100644
--- a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php
+++ b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php
@@ -26,10 +26,11 @@
  */
 class GraphvizDumper implements DumperInterface
 {
+    // All values should be strings
     protected static $defaultOptions = [
         'graph' => ['ratio' => 'compress', 'rankdir' => 'LR'],
-        'node' => ['fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'fillcolor' => 'lightblue', 'fixedsize' => true, 'width' => 1],
-        'edge' => ['fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'arrowhead' => 'normal', 'arrowsize' => 0.5],
+        'node' => ['fontsize' => '9', 'fontname' => 'Arial', 'color' => '#333333', 'fillcolor' => 'lightblue', 'fixedsize' => '1', 'width' => '1'],
+        'edge' => ['fontsize' => '9', 'fontname' => 'Arial', 'color' => '#333333', 'arrowhead' => 'normal', 'arrowsize' => '0.5'],
     ];
 
     /**

From 018ec1ae5cf6609535c61d7b3631a4d20e28702a Mon Sep 17 00:00:00 2001
From: Thomas Calvet 
Date: Wed, 19 Feb 2020 23:15:06 +0100
Subject: [PATCH 095/130] [DoctrineBridge][DoctrineExtractor] Fix indexBy with
 custom and some core types

---
 .../PropertyInfo/DoctrineExtractor.php        | 80 ++++++++++++-------
 .../PropertyInfo/DoctrineExtractorTest.php    | 13 +++
 .../PropertyInfo/Fixtures/DoctrineDummy.php   | 10 +++
 .../Fixtures/DoctrineRelation.php             | 10 +++
 4 files changed, 85 insertions(+), 28 deletions(-)

diff --git a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
index 1902adc0269a4..ea96b59f45043 100644
--- a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
+++ b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
@@ -117,7 +117,9 @@ public function getTypes($class, $property, array $context = [])
                         $typeOfField = $subMetadata->getTypeOfField($indexProperty);
                     }
 
-                    $collectionKeyType = $this->getPhpType($typeOfField);
+                    if (!$collectionKeyType = $this->getPhpType($typeOfField)) {
+                        return null;
+                    }
                 }
             }
 
@@ -137,39 +139,46 @@ public function getTypes($class, $property, array $context = [])
 
         if ($metadata->hasField($property)) {
             $typeOfField = $metadata->getTypeOfField($property);
-            $nullable = $metadata instanceof ClassMetadataInfo && $metadata->isNullable($property);
-
-            switch ($typeOfField) {
-                case DBALType::DATE:
-                case DBALType::DATETIME:
-                case DBALType::DATETIMETZ:
-                case 'vardatetime':
-                case DBALType::TIME:
-                    return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTime')];
 
-                case 'date_immutable':
-                case 'datetime_immutable':
-                case 'datetimetz_immutable':
-                case 'time_immutable':
-                    return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTimeImmutable')];
-
-                case 'dateinterval':
-                    return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateInterval')];
-
-                case DBALType::TARRAY:
-                    return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
+            if (!$builtinType = $this->getPhpType($typeOfField)) {
+                return null;
+            }
 
-                case DBALType::SIMPLE_ARRAY:
-                    return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING))];
+            $nullable = $metadata instanceof ClassMetadataInfo && $metadata->isNullable($property);
 
-                case DBALType::JSON_ARRAY:
-                    return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
+            switch ($builtinType) {
+                case Type::BUILTIN_TYPE_OBJECT:
+                    switch ($typeOfField) {
+                        case DBALType::DATE:
+                        case DBALType::DATETIME:
+                        case DBALType::DATETIMETZ:
+                        case 'vardatetime':
+                        case DBALType::TIME:
+                            return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTime')];
+
+                        case 'date_immutable':
+                        case 'datetime_immutable':
+                        case 'datetimetz_immutable':
+                        case 'time_immutable':
+                            return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTimeImmutable')];
+
+                        case 'dateinterval':
+                            return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateInterval')];
+                    }
 
-                default:
-                    $builtinType = $this->getPhpType($typeOfField);
+                    break;
+                case Type::BUILTIN_TYPE_ARRAY:
+                    switch ($typeOfField) {
+                        case DBALType::TARRAY:
+                        case DBALType::JSON_ARRAY:
+                            return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
 
-                    return $builtinType ? [new Type($builtinType, $nullable)] : null;
+                        case DBALType::SIMPLE_ARRAY:
+                            return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING))];
+                    }
             }
+
+            return [new Type($builtinType, $nullable)];
         }
 
         return null;
@@ -234,7 +243,22 @@ private function getPhpType($doctrineType)
                 return Type::BUILTIN_TYPE_RESOURCE;
 
             case DBALType::OBJECT:
+            case DBALType::DATE:
+            case DBALType::DATETIME:
+            case DBALType::DATETIMETZ:
+            case 'vardatetime':
+            case DBALType::TIME:
+            case 'date_immutable':
+            case 'datetime_immutable':
+            case 'datetimetz_immutable':
+            case 'time_immutable':
+            case 'dateinterval':
                 return Type::BUILTIN_TYPE_OBJECT;
+
+            case DBALType::TARRAY:
+            case DBALType::SIMPLE_ARRAY:
+            case DBALType::JSON_ARRAY:
+                return Type::BUILTIN_TYPE_ARRAY;
         }
 
         return null;
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
index cad2dfeaac89e..9c658a324613c 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
@@ -11,11 +11,13 @@
 
 namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo;
 
+use Doctrine\Common\Collections\Collection;
 use Doctrine\DBAL\Types\Type as DBALType;
 use Doctrine\ORM\EntityManager;
 use Doctrine\ORM\Tools\Setup;
 use PHPUnit\Framework\TestCase;
 use Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor;
+use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation;
 use Symfony\Component\PropertyInfo\Type;
 
 /**
@@ -62,6 +64,8 @@ public function testGetProperties()
                 'bar',
                 'indexedBar',
                 'indexedFoo',
+                'indexedByDt',
+                'indexedByCustomType',
             ],
             $this->extractor->getProperties('Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy')
         );
@@ -153,6 +157,15 @@ public function typesProvider()
             ['simpleArray', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING))]],
             ['customFoo', null],
             ['notMapped', null],
+            ['indexedByDt', [new Type(
+                Type::BUILTIN_TYPE_OBJECT,
+                false,
+                Collection::class,
+                true,
+                new Type(Type::BUILTIN_TYPE_OBJECT),
+                new Type(Type::BUILTIN_TYPE_OBJECT, false, DoctrineRelation::class)
+            )]],
+            ['indexedByCustomType', null],
         ];
     }
 
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
index d02deb15bb7b5..c8bd04e4ec5f4 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
@@ -112,4 +112,14 @@ class DoctrineDummy
     private $bigint;
 
     public $notMapped;
+
+    /**
+     * @OneToMany(targetEntity="DoctrineRelation", mappedBy="dt", indexBy="dt")
+     */
+    protected $indexedByDt;
+
+    /**
+     * @OneToMany(targetEntity="DoctrineRelation", mappedBy="customType", indexBy="customType")
+     */
+    private $indexedByCustomType;
 }
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php
index 85660d3d6b66c..5730cf81dd493 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php
@@ -39,4 +39,14 @@ class DoctrineRelation
      * @ManyToOne(targetEntity="DoctrineDummy", inversedBy="indexedFoo")
      */
     protected $foo;
+
+    /**
+     * @Column(type="datetime")
+     */
+    private $dt;
+
+    /**
+     * @Column(type="foo")
+     */
+    private $customType;
 }

From e8f3e8495906389c7d70ebb92c6a04639e5d297e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20TAMARELLE?= 
Date: Wed, 19 Feb 2020 22:39:02 +0100
Subject: [PATCH 096/130] Use strict assertion in asset tests

---
 .../Tests/Context/RequestStackContextTest.php    |  2 +-
 .../Component/Asset/Tests/PackageTest.php        |  4 ++--
 .../Component/Asset/Tests/PackagesTest.php       | 16 ++++++++--------
 .../Component/Asset/Tests/PathPackageTest.php    |  6 +++---
 .../Component/Asset/Tests/UrlPackageTest.php     |  6 +++---
 .../VersionStrategy/EmptyVersionStrategyTest.php |  2 +-
 .../JsonManifestVersionStrategyTest.php          |  6 +++---
 .../StaticVersionStrategyTest.php                |  4 ++--
 8 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/Symfony/Component/Asset/Tests/Context/RequestStackContextTest.php b/src/Symfony/Component/Asset/Tests/Context/RequestStackContextTest.php
index 7f24534eba202..d9a54c066ec3e 100644
--- a/src/Symfony/Component/Asset/Tests/Context/RequestStackContextTest.php
+++ b/src/Symfony/Component/Asset/Tests/Context/RequestStackContextTest.php
@@ -37,7 +37,7 @@ public function testGetBasePathSet()
 
         $requestStackContext = new RequestStackContext($requestStack);
 
-        $this->assertEquals($testBasePath, $requestStackContext->getBasePath());
+        $this->assertSame($testBasePath, $requestStackContext->getBasePath());
     }
 
     public function testIsSecureFalse()
diff --git a/src/Symfony/Component/Asset/Tests/PackageTest.php b/src/Symfony/Component/Asset/Tests/PackageTest.php
index 8f6626ae4d2ad..8d7f7b8a26a71 100644
--- a/src/Symfony/Component/Asset/Tests/PackageTest.php
+++ b/src/Symfony/Component/Asset/Tests/PackageTest.php
@@ -24,7 +24,7 @@ class PackageTest extends TestCase
     public function testGetUrl($version, $format, $path, $expected)
     {
         $package = new Package($version ? new StaticVersionStrategy($version, $format) : new EmptyVersionStrategy());
-        $this->assertEquals($expected, $package->getUrl($path));
+        $this->assertSame($expected, $package->getUrl($path));
     }
 
     public function getConfigs()
@@ -50,6 +50,6 @@ public function getConfigs()
     public function testGetVersion()
     {
         $package = new Package(new StaticVersionStrategy('v1'));
-        $this->assertEquals('v1', $package->getVersion('/foo'));
+        $this->assertSame('v1', $package->getVersion('/foo'));
     }
 }
diff --git a/src/Symfony/Component/Asset/Tests/PackagesTest.php b/src/Symfony/Component/Asset/Tests/PackagesTest.php
index b2d0de375051e..4b30e30a5e482 100644
--- a/src/Symfony/Component/Asset/Tests/PackagesTest.php
+++ b/src/Symfony/Component/Asset/Tests/PackagesTest.php
@@ -24,13 +24,13 @@ public function testGetterSetters()
         $packages->setDefaultPackage($default = $this->getMockBuilder('Symfony\Component\Asset\PackageInterface')->getMock());
         $packages->addPackage('a', $a = $this->getMockBuilder('Symfony\Component\Asset\PackageInterface')->getMock());
 
-        $this->assertEquals($default, $packages->getPackage());
-        $this->assertEquals($a, $packages->getPackage('a'));
+        $this->assertSame($default, $packages->getPackage());
+        $this->assertSame($a, $packages->getPackage('a'));
 
         $packages = new Packages($default, ['a' => $a]);
 
-        $this->assertEquals($default, $packages->getPackage());
-        $this->assertEquals($a, $packages->getPackage('a'));
+        $this->assertSame($default, $packages->getPackage());
+        $this->assertSame($a, $packages->getPackage('a'));
     }
 
     public function testGetVersion()
@@ -40,8 +40,8 @@ public function testGetVersion()
             ['a' => new Package(new StaticVersionStrategy('a'))]
         );
 
-        $this->assertEquals('default', $packages->getVersion('/foo'));
-        $this->assertEquals('a', $packages->getVersion('/foo', 'a'));
+        $this->assertSame('default', $packages->getVersion('/foo'));
+        $this->assertSame('a', $packages->getVersion('/foo', 'a'));
     }
 
     public function testGetUrl()
@@ -51,8 +51,8 @@ public function testGetUrl()
             ['a' => new Package(new StaticVersionStrategy('a'))]
         );
 
-        $this->assertEquals('/foo?default', $packages->getUrl('/foo'));
-        $this->assertEquals('/foo?a', $packages->getUrl('/foo', 'a'));
+        $this->assertSame('/foo?default', $packages->getUrl('/foo'));
+        $this->assertSame('/foo?a', $packages->getUrl('/foo', 'a'));
     }
 
     public function testNoDefaultPackage()
diff --git a/src/Symfony/Component/Asset/Tests/PathPackageTest.php b/src/Symfony/Component/Asset/Tests/PathPackageTest.php
index d00cc76c2a943..4d57559847eb1 100644
--- a/src/Symfony/Component/Asset/Tests/PathPackageTest.php
+++ b/src/Symfony/Component/Asset/Tests/PathPackageTest.php
@@ -23,7 +23,7 @@ class PathPackageTest extends TestCase
     public function testGetUrl($basePath, $format, $path, $expected)
     {
         $package = new PathPackage($basePath, new StaticVersionStrategy('v1', $format));
-        $this->assertEquals($expected, $package->getUrl($path));
+        $this->assertSame($expected, $package->getUrl($path));
     }
 
     public function getConfigs()
@@ -55,7 +55,7 @@ public function testGetUrlWithContext($basePathRequest, $basePath, $format, $pat
     {
         $package = new PathPackage($basePath, new StaticVersionStrategy('v1', $format), $this->getContext($basePathRequest));
 
-        $this->assertEquals($expected, $package->getUrl($path));
+        $this->assertSame($expected, $package->getUrl($path));
     }
 
     public function getContextConfigs()
@@ -83,7 +83,7 @@ public function testVersionStrategyGivesAbsoluteURL()
             ->willReturn('https://cdn.com/bar/main.css');
         $package = new PathPackage('/subdirectory', $versionStrategy, $this->getContext('/bar'));
 
-        $this->assertEquals('https://cdn.com/bar/main.css', $package->getUrl('main.css'));
+        $this->assertSame('https://cdn.com/bar/main.css', $package->getUrl('main.css'));
     }
 
     private function getContext($basePath)
diff --git a/src/Symfony/Component/Asset/Tests/UrlPackageTest.php b/src/Symfony/Component/Asset/Tests/UrlPackageTest.php
index 8fc617a682201..196c2ead3b264 100644
--- a/src/Symfony/Component/Asset/Tests/UrlPackageTest.php
+++ b/src/Symfony/Component/Asset/Tests/UrlPackageTest.php
@@ -24,7 +24,7 @@ class UrlPackageTest extends TestCase
     public function testGetUrl($baseUrls, $format, $path, $expected)
     {
         $package = new UrlPackage($baseUrls, new StaticVersionStrategy('v1', $format));
-        $this->assertEquals($expected, $package->getUrl($path));
+        $this->assertSame($expected, $package->getUrl($path));
     }
 
     public function getConfigs()
@@ -58,7 +58,7 @@ public function testGetUrlWithContext($secure, $baseUrls, $format, $path, $expec
     {
         $package = new UrlPackage($baseUrls, new StaticVersionStrategy('v1', $format), $this->getContext($secure));
 
-        $this->assertEquals($expected, $package->getUrl($path));
+        $this->assertSame($expected, $package->getUrl($path));
     }
 
     public function getContextConfigs()
@@ -85,7 +85,7 @@ public function testVersionStrategyGivesAbsoluteURL()
             ->willReturn('https://cdn.com/bar/main.css');
         $package = new UrlPackage('https://example.com', $versionStrategy);
 
-        $this->assertEquals('https://cdn.com/bar/main.css', $package->getUrl('main.css'));
+        $this->assertSame('https://cdn.com/bar/main.css', $package->getUrl('main.css'));
     }
 
     public function testNoBaseUrls()
diff --git a/src/Symfony/Component/Asset/Tests/VersionStrategy/EmptyVersionStrategyTest.php b/src/Symfony/Component/Asset/Tests/VersionStrategy/EmptyVersionStrategyTest.php
index 430146fd5070b..1728c2e99b4d4 100644
--- a/src/Symfony/Component/Asset/Tests/VersionStrategy/EmptyVersionStrategyTest.php
+++ b/src/Symfony/Component/Asset/Tests/VersionStrategy/EmptyVersionStrategyTest.php
@@ -29,6 +29,6 @@ public function testApplyVersion()
         $emptyVersionStrategy = new EmptyVersionStrategy();
         $path = 'test-path';
 
-        $this->assertEquals($path, $emptyVersionStrategy->applyVersion($path));
+        $this->assertSame($path, $emptyVersionStrategy->applyVersion($path));
     }
 }
diff --git a/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php b/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php
index d74f3f6321687..ffcc62b995d37 100644
--- a/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php
+++ b/src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php
@@ -20,21 +20,21 @@ public function testGetVersion()
     {
         $strategy = $this->createStrategy('manifest-valid.json');
 
-        $this->assertEquals('main.123abc.js', $strategy->getVersion('main.js'));
+        $this->assertSame('main.123abc.js', $strategy->getVersion('main.js'));
     }
 
     public function testApplyVersion()
     {
         $strategy = $this->createStrategy('manifest-valid.json');
 
-        $this->assertEquals('css/styles.555def.css', $strategy->getVersion('css/styles.css'));
+        $this->assertSame('css/styles.555def.css', $strategy->getVersion('css/styles.css'));
     }
 
     public function testApplyVersionWhenKeyDoesNotExistInManifest()
     {
         $strategy = $this->createStrategy('manifest-valid.json');
 
-        $this->assertEquals('css/other.css', $strategy->getVersion('css/other.css'));
+        $this->assertSame('css/other.css', $strategy->getVersion('css/other.css'));
     }
 
     public function testMissingManifestFileThrowsException()
diff --git a/src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php b/src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php
index c56a8726a8459..d054e842f2c55 100644
--- a/src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php
+++ b/src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php
@@ -21,7 +21,7 @@ public function testGetVersion()
         $version = 'v1';
         $path = 'test-path';
         $staticVersionStrategy = new StaticVersionStrategy($version);
-        $this->assertEquals($version, $staticVersionStrategy->getVersion($path));
+        $this->assertSame($version, $staticVersionStrategy->getVersion($path));
     }
 
     /**
@@ -31,7 +31,7 @@ public function testApplyVersion($path, $version, $format)
     {
         $staticVersionStrategy = new StaticVersionStrategy($version, $format);
         $formatted = sprintf($format ?: '%s?%s', $path, $version);
-        $this->assertEquals($formatted, $staticVersionStrategy->applyVersion($path));
+        $this->assertSame($formatted, $staticVersionStrategy->applyVersion($path));
     }
 
     public function getConfigs()

From 3515793cb353cb30a260ac76b720288e23a1fefe Mon Sep 17 00:00:00 2001
From: Nicolas PHILIPPE 
Date: Wed, 19 Feb 2020 20:56:03 +0100
Subject: [PATCH 097/130] fix remember me

---
 .../Provider/RememberMeAuthenticationProvider.php  |  7 +++++++
 .../RememberMeAuthenticationProviderTest.php       | 14 ++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php
index d9a6883cf9a96..e1a22b79a8b30 100644
--- a/src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php
+++ b/src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php
@@ -15,7 +15,9 @@
 use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
 use Symfony\Component\Security\Core\Exception\AuthenticationException;
 use Symfony\Component\Security\Core\Exception\BadCredentialsException;
+use Symfony\Component\Security\Core\Exception\LogicException;
 use Symfony\Component\Security\Core\User\UserCheckerInterface;
+use Symfony\Component\Security\Core\User\UserInterface;
 
 class RememberMeAuthenticationProvider implements AuthenticationProviderInterface
 {
@@ -49,6 +51,11 @@ public function authenticate(TokenInterface $token)
         }
 
         $user = $token->getUser();
+
+        if (!$token->getUser() instanceof UserInterface) {
+            throw new LogicException(sprintf('Method "%s::getUser()" must return a "%s" instance, "%s" returned.', \get_class($token), UserInterface::class, \is_object($user) ? \get_class($user) : \gettype($user)));
+        }
+
         $this->userChecker->checkPreAuth($user);
         $this->userChecker->checkPostAuth($user);
 
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
index 418cd77df4fc1..ce0502269e012 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
@@ -13,8 +13,10 @@
 
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
+use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
 use Symfony\Component\Security\Core\Exception\DisabledException;
 use Symfony\Component\Security\Core\Role\Role;
+use Symfony\Component\Security\Core\User\User;
 
 class RememberMeAuthenticationProviderTest extends TestCase
 {
@@ -24,6 +26,7 @@ public function testSupports()
 
         $this->assertTrue($provider->supports($this->getSupportedToken()));
         $this->assertFalse($provider->supports($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()));
+        $this->assertFalse($provider->supports($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\RememberMeToken')->disableOriginalConstructor()->getMock()));
     }
 
     public function testAuthenticateWhenTokenIsNotSupported()
@@ -45,6 +48,17 @@ public function testAuthenticateWhenSecretsDoNotMatch()
         $provider->authenticate($token);
     }
 
+    public function testAuthenticateThrowsOnNonUserInterfaceInstance()
+    {
+        $this->expectException('Symfony\Component\Security\Core\Exception\LogicException');
+        $this->expectExceptionMessage('Method "Symfony\Component\Security\Core\Authentication\Token\RememberMeToken::getUser()" must return a "Symfony\Component\Security\Core\User\UserInterface" instance, "string" returned.');
+
+        $provider = $this->getProvider();
+        $token = new RememberMeToken(new User('dummyuser', null), 'foo', 'test');
+        $token->setUser('stringish-user');
+        $provider->authenticate($token);
+    }
+
     public function testAuthenticateWhenPreChecksFails()
     {
         $this->expectException('Symfony\Component\Security\Core\Exception\DisabledException');

From 971b177d27ec43fca1ed6c027971190508bc5063 Mon Sep 17 00:00:00 2001
From: Trevor North 
Date: Thu, 20 Feb 2020 16:09:42 +0000
Subject: [PATCH 098/130] Fix versioned namespace clears

When using namespace versioning to achieve atomic cache clears, only
delete cache keys matching the old/current version.

This resolves tag inconsistency issues whereby the process running the
clear would delete keys set against the new version by more recently
spawned concurreny processes. Most seriously this could result in newly
set data keys remaining, but with empty associated tag sets meaning the
invalidation via tags was no longer possible.

Clearing specific prefixes is not supported when using versioned
namespaces as it is desirable to clear all old keys as they will no
longer be used and would otherwise eventually fill cache memory.
---
 src/Symfony/Component/Cache/Traits/AbstractTrait.php | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/Symfony/Component/Cache/Traits/AbstractTrait.php b/src/Symfony/Component/Cache/Traits/AbstractTrait.php
index f9a1d8fdafa26..7639424ea78ce 100644
--- a/src/Symfony/Component/Cache/Traits/AbstractTrait.php
+++ b/src/Symfony/Component/Cache/Traits/AbstractTrait.php
@@ -111,9 +111,14 @@ public function hasItem($key)
      */
     public function clear(/*string $prefix = ''*/)
     {
-        $prefix = 0 < \func_num_args() ? (string) func_get_arg(0) : '';
         $this->deferred = [];
         if ($cleared = $this->versioningIsEnabled) {
+            if ('' === $namespaceVersionToClear = $this->namespaceVersion) {
+                foreach ($this->doFetch([static::NS_SEPARATOR.$this->namespace]) as $v) {
+                    $namespaceVersionToClear = $v;
+                }
+            }
+            $namespaceToClear = $this->namespace.$namespaceVersionToClear;
             $namespaceVersion = substr_replace(base64_encode(pack('V', mt_rand())), static::NS_SEPARATOR, 5);
             try {
                 $cleared = $this->doSave([static::NS_SEPARATOR.$this->namespace => $namespaceVersion], 0);
@@ -124,10 +129,13 @@ public function clear(/*string $prefix = ''*/)
                 $this->namespaceVersion = $namespaceVersion;
                 $this->ids = [];
             }
+        } else {
+            $prefix = 0 < \func_num_args() ? (string) func_get_arg(0) : '';
+            $namespaceToClear = $this->namespace.$prefix;
         }
 
         try {
-            return $this->doClear($this->namespace.$prefix) || $cleared;
+            return $this->doClear($namespaceToClear) || $cleared;
         } catch (\Exception $e) {
             CacheItem::log($this->logger, 'Failed to clear the cache: '.$e->getMessage(), ['exception' => $e]);
 

From 034e1de6e66a964b3bd4d56bfd78b118b147bcce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcello=20M=C3=B6nkemeyer?= 
Date: Wed, 19 Feb 2020 14:20:42 +0000
Subject: [PATCH 099/130] [PhpUnitBridge] Use trait instead of extending
 deprecated class

---
 .../Bridge/PhpUnit/Legacy/CoverageListenerForV6.php        | 7 +++++--
 src/Symfony/Bridge/PhpUnit/composer.json                   | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerForV6.php b/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerForV6.php
index 0917ea4710c21..1b3ceec161f8a 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerForV6.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerForV6.php
@@ -11,8 +11,9 @@
 
 namespace Symfony\Bridge\PhpUnit\Legacy;
 
-use PHPUnit\Framework\BaseTestListener;
 use PHPUnit\Framework\Test;
+use PHPUnit\Framework\TestListener;
+use PHPUnit\Framework\TestListenerDefaultImplementation;
 
 /**
  * CoverageListener adds `@covers ` on each test when possible to
@@ -22,8 +23,10 @@
  *
  * @internal
  */
-class CoverageListenerForV6 extends BaseTestListener
+class CoverageListenerForV6 implements TestListener
 {
+    use TestListenerDefaultImplementation;
+
     private $trait;
 
     public function __construct(callable $sutFqcnResolver = null, $warningOnSutNotFound = false)
diff --git a/src/Symfony/Bridge/PhpUnit/composer.json b/src/Symfony/Bridge/PhpUnit/composer.json
index 25dcb0cd10272..f7d9492613ab6 100644
--- a/src/Symfony/Bridge/PhpUnit/composer.json
+++ b/src/Symfony/Bridge/PhpUnit/composer.json
@@ -24,7 +24,7 @@
         "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader"
     },
     "conflict": {
-        "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
+        "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0|<6.4,>=6.0"
     },
     "autoload": {
         "files": [ "bootstrap.php" ],

From 0086562c771c2a3e12d901583624e1bbd44aa46e Mon Sep 17 00:00:00 2001
From: Maxime Steinhausser 
Date: Fri, 21 Feb 2020 16:29:16 +0100
Subject: [PATCH 100/130] [Validator] Remove specific check for Valid targets

---
 src/Symfony/Component/Validator/Mapping/ClassMetadata.php | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php
index 03b0ae6d8f575..aaa30cddd3b47 100644
--- a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php
+++ b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php
@@ -14,7 +14,6 @@
 use Symfony\Component\Validator\Constraint;
 use Symfony\Component\Validator\Constraints\GroupSequence;
 use Symfony\Component\Validator\Constraints\Traverse;
-use Symfony\Component\Validator\Constraints\Valid;
 use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
 use Symfony\Component\Validator\Exception\GroupDefinitionException;
 
@@ -183,10 +182,6 @@ public function addConstraint(Constraint $constraint)
             throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint)));
         }
 
-        if ($constraint instanceof Valid) {
-            throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint)));
-        }
-
         if ($constraint instanceof Traverse) {
             if ($constraint->traverse) {
                 // If traverse is true, traversal should be explicitly enabled

From 1ff5e3c83f5a9d7e9d82787845b51a928380589c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Sch=C3=A4dlich?= 
Date: Sat, 22 Feb 2020 13:45:12 +0100
Subject: [PATCH 101/130] [Notifier] Add correct tags for NullTransportFactory

---
 .../FrameworkBundle/Resources/config/notifier_transports.xml   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.xml
index c4d9cf892adca..2b7d14b25b6f7 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.xml
@@ -27,7 +27,8 @@
         
 
         
-            
+            
+            
         
     
 

From 2993fc9fc52b88e0b95355b1b38f2d07a5d39fa2 Mon Sep 17 00:00:00 2001
From: Vincent Langlet 
Date: Tue, 18 Feb 2020 23:28:46 +0100
Subject: [PATCH 102/130] Return int if scale = 0

---
 .../Core/DataTransformer/NumberToLocalizedStringTransformer.php | 2 +-
 .../DataTransformer/NumberToLocalizedStringTransformerTest.php  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
index 8eddd85070285..fe9002fe47f5b 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
@@ -282,7 +282,7 @@ private function round($number)
                     break;
             }
 
-            $number /= $roundingCoef;
+            $number = 1 === $roundingCoef ? (int) $number : $number / $roundingCoef;
         }
 
         return $number;
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
index 30b93c66feb52..fc76f9b53e398 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
@@ -370,7 +370,7 @@ public function testReverseTransformWithRounding($scale, $input, $output, $round
     {
         $transformer = new NumberToLocalizedStringTransformer($scale, null, $roundingMode);
 
-        $this->assertEquals($output, $transformer->reverseTransform($input));
+        $this->assertSame($output, $transformer->reverseTransform($input));
     }
 
     public function testReverseTransformDoesNotRoundIfNoScale()

From dedbc4d814c719c18aec3ace4364071e8ccb0b42 Mon Sep 17 00:00:00 2001
From: Dieter 
Date: Sat, 22 Feb 2020 21:09:08 +0100
Subject: [PATCH 103/130] remove usage of already deleted
 Symfony\Component\EventDispatcher\Event

---
 .../DependencyInjection/RegisterListenersPass.php               | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php b/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
index 7820d35c31311..2bbebb7d6f794 100644
--- a/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
+++ b/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
@@ -16,7 +16,6 @@
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
 use Symfony\Component\DependencyInjection\Reference;
-use Symfony\Component\EventDispatcher\Event as LegacyEvent;
 use Symfony\Component\EventDispatcher\EventDispatcher;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 use Symfony\Contracts\EventDispatcher\Event;
@@ -141,7 +140,6 @@ private function getEventFromTypeDeclaration(ContainerBuilder $container, string
             || !($type = $m->getParameters()[0]->getType())
             || $type->isBuiltin()
             || Event::class === ($name = $type->getName())
-            || LegacyEvent::class === $name
         ) {
             throw new InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "%s" tags.', $id, $this->listenerTag));
         }

From 24cfb7f095d7dfdfc29b94302c80a668c5047075 Mon Sep 17 00:00:00 2001
From: Robin Chalas 
Date: Sun, 23 Feb 2020 06:45:13 +0100
Subject: [PATCH 104/130] [FrameworkBundle] Skip notifiers tags in
 UnusedTagsPass

---
 .../DependencyInjection/Compiler/UnusedTagsPass.php             | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php
index 5bbcb7452e73d..7a966fd2144ea 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php
@@ -24,6 +24,7 @@ class UnusedTagsPass implements CompilerPassInterface
     private $whitelist = [
         'annotations.cached_reader',
         'cache.pool.clearer',
+        'chatter.transport_factory',
         'console.command',
         'container.hot_path',
         'container.reversible',
@@ -56,6 +57,7 @@ class UnusedTagsPass implements CompilerPassInterface
         'security.voter',
         'serializer.encoder',
         'serializer.normalizer',
+        'texter.transport_factory',
         'translation.dumper',
         'translation.extractor',
         'translation.loader',

From 4b83ae7547da7f5cc0b971208ac50dd3889a48dc Mon Sep 17 00:00:00 2001
From: Andrey Sevastianov 
Date: Thu, 13 Feb 2020 19:48:28 +0200
Subject: [PATCH 105/130] [ExpressionLanguage] Fixed collisions of character
 operators with object properties

---
 .../Component/ExpressionLanguage/Lexer.php    |  2 +-
 .../Resources/bin/generate_operator_regex.php | 10 ++++--
 .../Tests/ExpressionLanguageTest.php          | 11 +++++++
 .../ExpressionLanguage/Tests/LexerTest.php    | 12 +++++++
 .../ExpressionLanguage/Tests/ParserTest.php   | 33 +++++++++++++++++++
 5 files changed, 64 insertions(+), 4 deletions(-)

diff --git a/src/Symfony/Component/ExpressionLanguage/Lexer.php b/src/Symfony/Component/ExpressionLanguage/Lexer.php
index 48b15ffe7c235..01ca293018365 100644
--- a/src/Symfony/Component/ExpressionLanguage/Lexer.php
+++ b/src/Symfony/Component/ExpressionLanguage/Lexer.php
@@ -73,7 +73,7 @@ public function tokenize($expression)
                 // strings
                 $tokens[] = new Token(Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1)), $cursor + 1);
                 $cursor += \strlen($match[0]);
-            } elseif (preg_match('/not in(?=[\s(])|\!\=\=|not(?=[\s(])|and(?=[\s(])|\=\=\=|\>\=|or(?=[\s(])|\<\=|\*\*|\.\.|in(?=[\s(])|&&|\|\||matches|\=\=|\!\=|\*|~|%|\/|\>|\||\!|\^|&|\+|\<|\-/A', $expression, $match, 0, $cursor)) {
+            } elseif (preg_match('/(?<=^|[\s(])not in(?=[\s(])|\!\=\=|(?<=^|[\s(])not(?=[\s(])|(?<=^|[\s(])and(?=[\s(])|\=\=\=|\>\=|(?<=^|[\s(])or(?=[\s(])|\<\=|\*\*|\.\.|(?<=^|[\s(])in(?=[\s(])|&&|\|\||(?<=^|[\s(])matches|\=\=|\!\=|\*|~|%|\/|\>|\||\!|\^|&|\+|\<|\-/A', $expression, $match, 0, $cursor)) {
                 // operators
                 $tokens[] = new Token(Token::OPERATOR_TYPE, $match[0], $cursor + 1);
                 $cursor += \strlen($match[0]);
diff --git a/src/Symfony/Component/ExpressionLanguage/Resources/bin/generate_operator_regex.php b/src/Symfony/Component/ExpressionLanguage/Resources/bin/generate_operator_regex.php
index e1196c7f514af..c86e962526182 100644
--- a/src/Symfony/Component/ExpressionLanguage/Resources/bin/generate_operator_regex.php
+++ b/src/Symfony/Component/ExpressionLanguage/Resources/bin/generate_operator_regex.php
@@ -15,9 +15,13 @@
 
 $regex = [];
 foreach ($operators as $operator => $length) {
-    // an operator that ends with a character must be followed by
-    // a whitespace or a parenthesis
-    $regex[] = preg_quote($operator, '/').(ctype_alpha($operator[$length - 1]) ? '(?=[\s(])' : '');
+    // Collisions of character operators:
+    // - an operator that begins with a character must have a space or a parenthesis before or starting at the beginning of a string
+    // - an operator that ends with a character must be followed by a whitespace or a parenthesis
+    $regex[] =
+        (ctype_alpha($operator[0]) ? '(?<=^|[\s(])' : '')
+        .preg_quote($operator, '/')
+        .(ctype_alpha($operator[$length - 1]) ? '(?=[\s(])' : '');
 }
 
 echo '/'.implode('|', $regex).'/A';
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
index f69ee57982e8a..fc2f80e17b3aa 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
@@ -233,6 +233,17 @@ public function testCachingWithDifferentNamesOrder()
         $expressionLanguage->compile($expression, ['B' => 'b', 'a']);
     }
 
+    public function testOperatorCollisions()
+    {
+        $expressionLanguage = new ExpressionLanguage();
+        $expression = 'foo.not in [bar]';
+        $compiled = $expressionLanguage->compile($expression, ['foo', 'bar']);
+        $this->assertSame('in_array($foo->not, [0 => $bar])', $compiled);
+
+        $result = $expressionLanguage->evaluate($expression, ['foo' => (object) ['not' => 'test'], 'bar' => 'test']);
+        $this->assertTrue($result);
+    }
+
     /**
      * @dataProvider getRegisterCallbacks
      */
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
index 9ab6b1e843ce0..6c3d1a7d25196 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php
@@ -112,6 +112,18 @@ public function getTokenizeData()
                 [new Token('string', '#foo', 1)],
                 '"#foo"',
             ],
+            [
+                [
+                    new Token('name', 'foo', 1),
+                    new Token('punctuation', '.', 4),
+                    new Token('name', 'not', 5),
+                    new Token('operator', 'in', 9),
+                    new Token('punctuation', '[', 12),
+                    new Token('name', 'bar', 13),
+                    new Token('punctuation', ']', 16),
+                ],
+                'foo.not in [bar]',
+            ],
         ];
     }
 }
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
index 84b30dc151cf4..2d5a0a6c8c817 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
@@ -53,6 +53,9 @@ public function getParseData()
         $arguments->addElement(new Node\ConstantNode(2));
         $arguments->addElement(new Node\ConstantNode(true));
 
+        $arrayNode = new Node\ArrayNode();
+        $arrayNode->addElement(new Node\NameNode('bar'));
+
         return [
             [
                 new Node\NameNode('a'),
@@ -151,6 +154,36 @@ public function getParseData()
                 'bar',
                 ['foo' => 'bar'],
             ],
+
+            // Operators collisions
+            [
+                new Node\BinaryNode(
+                    'in',
+                    new Node\GetAttrNode(
+                        new Node\NameNode('foo'),
+                        new Node\ConstantNode('not', true),
+                        new Node\ArgumentsNode(),
+                        Node\GetAttrNode::PROPERTY_CALL
+                    ),
+                    $arrayNode
+                ),
+                'foo.not in [bar]',
+                ['foo', 'bar'],
+            ],
+            [
+                new Node\BinaryNode(
+                    'or',
+                    new Node\UnaryNode('not', new Node\NameNode('foo')),
+                    new Node\GetAttrNode(
+                        new Node\NameNode('foo'),
+                        new Node\ConstantNode('not', true),
+                        new Node\ArgumentsNode(),
+                        Node\GetAttrNode::PROPERTY_CALL
+                    )
+                ),
+                'not foo or foo.not',
+                ['foo'],
+            ],
         ];
     }
 

From e15f05e03fd9891fcc256dc781bd272f8123ab79 Mon Sep 17 00:00:00 2001
From: Anna Filina 
Date: Sat, 22 Feb 2020 09:12:42 -0500
Subject: [PATCH 106/130] [BrowserKit] Nested file array prevents uploading
 file

---
 .../Component/BrowserKit/HttpBrowser.php      | 35 ++++---
 .../BrowserKit/Tests/HttpBrowserTest.php      | 94 ++++++++++++++++++-
 2 files changed, 114 insertions(+), 15 deletions(-)

diff --git a/src/Symfony/Component/BrowserKit/HttpBrowser.php b/src/Symfony/Component/BrowserKit/HttpBrowser.php
index b2331ea492a84..a1e6dd9af0119 100644
--- a/src/Symfony/Component/BrowserKit/HttpBrowser.php
+++ b/src/Symfony/Component/BrowserKit/HttpBrowser.php
@@ -73,18 +73,9 @@ private function getBodyAndExtraHeaders(Request $request): array
         }
 
         $fields = $request->getParameters();
-        $hasFile = false;
-        foreach ($request->getFiles() as $name => $file) {
-            if (!isset($file['tmp_name'])) {
-                continue;
-            }
-
-            $hasFile = true;
-            $fields[$name] = DataPart::fromPath($file['tmp_name'], $file['name']);
-        }
 
-        if ($hasFile) {
-            $part = new FormDataPart($fields);
+        if ($uploadedFiles = $this->getUploadedFiles($request->getFiles())) {
+            $part = new FormDataPart($uploadedFiles);
 
             return [$part->bodyToIterable(), $part->getPreparedHeaders()->toArray()];
         }
@@ -119,4 +110,26 @@ private function getHeaders(Request $request): array
 
         return $headers;
     }
+
+    /**
+     * Recursively go through the list. If the file has a tmp_name, convert it to a DataPart.
+     * Keep the original hierarchy.
+     */
+    private function getUploadedFiles(array $files): array
+    {
+        $uploadedFiles = [];
+        foreach ($files as $name => $file) {
+            if (!\is_array($file)) {
+                return $uploadedFiles;
+            }
+            if (!isset($file['tmp_name'])) {
+                $uploadedFiles[$name] = $this->getUploadedFiles($file);
+            }
+            if (isset($file['tmp_name'])) {
+                $uploadedFiles[$name] = DataPart::fromPath($file['tmp_name'], $file['name']);
+            }
+        }
+
+        return $uploadedFiles;
+    }
 }
diff --git a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php
index 44eed997bdeed..fa3d531aa986d 100644
--- a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php
+++ b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php
@@ -27,17 +27,17 @@ public function getBrowser(array $server = [], History $history = null, CookieJa
     /**
      * @dataProvider validContentTypes
      */
-    public function testRequestHeaders(array $request, array $exepectedCall)
+    public function testRequestHeaders(array $requestArguments, array $expectedArguments)
     {
         $client = $this->createMock(HttpClientInterface::class);
         $client
             ->expects($this->once())
             ->method('request')
-            ->with(...$exepectedCall)
+            ->with(...$expectedArguments)
             ->willReturn($this->createMock(ResponseInterface::class));
 
         $browser = new HttpBrowser($client);
-        $browser->request(...$request);
+        $browser->request(...$requestArguments);
     }
 
     public function validContentTypes()
@@ -61,7 +61,7 @@ public function validContentTypes()
         ];
     }
 
-    public function testMultiPartRequest()
+    public function testMultiPartRequestWithSingleFile()
     {
         $client = $this->createMock(HttpClientInterface::class);
         $client
@@ -81,4 +81,90 @@ public function testMultiPartRequest()
         file_put_contents($path, 'my_file');
         $browser->request('POST', 'http://example.com/', [], ['file' => ['tmp_name' => $path, 'name' => 'foo']]);
     }
+
+    public function testMultiPartRequestWithNormalFlatArray()
+    {
+        $client = $this->createMock(HttpClientInterface::class);
+        $this->expectClientToSendRequestWithFiles($client, ['file1_content', 'file2_content']);
+
+        $browser = new HttpBrowser($client);
+        $browser->request('POST', 'http://example.com/', [], [
+            'file1' => $this->getUploadedFile('file1'),
+            'file2' => $this->getUploadedFile('file2'),
+        ]);
+    }
+
+    public function testMultiPartRequestWithNormalNestedArray()
+    {
+        $client = $this->createMock(HttpClientInterface::class);
+        $this->expectClientToSendRequestWithFiles($client, ['file1_content', 'file2_content']);
+
+        $browser = new HttpBrowser($client);
+        $browser->request('POST', 'http://example.com/', [], [
+            'level1' => [
+                'level2' => [
+                    'file1' => $this->getUploadedFile('file1'),
+                    'file2' => $this->getUploadedFile('file2'),
+                ],
+            ],
+        ]);
+    }
+
+    public function testMultiPartRequestWithBracketedArray()
+    {
+        $client = $this->createMock(HttpClientInterface::class);
+        $this->expectClientToSendRequestWithFiles($client, ['file1_content', 'file2_content']);
+
+        $browser = new HttpBrowser($client);
+        $browser->request('POST', 'http://example.com/', [], [
+            'form[file1]' => $this->getUploadedFile('file1'),
+            'form[file2]' => $this->getUploadedFile('file2'),
+        ]);
+    }
+
+    public function testMultiPartRequestWithInvalidItem()
+    {
+        $client = $this->createMock(HttpClientInterface::class);
+        $this->expectClientToSendRequestWithFiles($client, ['file1_content']);
+
+        $browser = new HttpBrowser($client);
+        $browser->request('POST', 'http://example.com/', [], [
+            'file1' => $this->getUploadedFile('file1'),
+            'file2' => 'INVALID',
+        ]);
+    }
+
+    private function uploadFile(string $data): string
+    {
+        $path = tempnam(sys_get_temp_dir(), 'http');
+        file_put_contents($path, $data);
+
+        return $path;
+    }
+
+    private function getUploadedFile(string $name): array
+    {
+        return [
+            'tmp_name' => $this->uploadFile($name.'_content'),
+            'name' => $name.'_name',
+        ];
+    }
+
+    protected function expectClientToSendRequestWithFiles(HttpClientInterface $client, $fileContents)
+    {
+        $client
+            ->expects($this->once())
+            ->method('request')
+            ->with('POST', 'http://example.com/', $this->callback(function ($options) use ($fileContents) {
+                $this->assertStringContainsString('Content-Type: multipart/form-data', implode('', $options['headers']));
+                $this->assertInstanceOf('\Generator', $options['body']);
+                $body = implode('', iterator_to_array($options['body'], false));
+                foreach ($fileContents as $content) {
+                    $this->assertStringContainsString($content, $body);
+                }
+
+                return true;
+            }))
+            ->willReturn($this->createMock(ResponseInterface::class));
+    }
 }

From 83d4aa7683cee0b33dedc09402bfa82a77c85371 Mon Sep 17 00:00:00 2001
From: Jules Pietri 
Date: Sun, 23 Feb 2020 12:54:43 +0100
Subject: [PATCH 107/130] [Debug][ErrorHandler] improved deprecation notices
 for methods new args and return type

---
 src/Symfony/Component/Debug/DebugClassLoader.php |  2 +-
 .../Debug/Tests/DebugClassLoaderTest.php         | 12 ++++++------
 .../Component/ErrorHandler/DebugClassLoader.php  |  4 ++--
 .../ErrorHandler/Tests/DebugClassLoaderTest.php  | 16 ++++++++--------
 src/Symfony/Component/ErrorHandler/composer.json |  2 +-
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php
index 9e071fc7600a3..3ff450b70058e 100644
--- a/src/Symfony/Component/Debug/DebugClassLoader.php
+++ b/src/Symfony/Component/Debug/DebugClassLoader.php
@@ -391,7 +391,7 @@ public function checkAnnotations(\ReflectionClass $refl, $class)
             foreach ($matches as list(, $parameterType, $parameterName)) {
                 if (!isset($definedParameters[$parameterName])) {
                     $parameterType = trim($parameterType);
-                    self::$annotatedParameters[$class][$method->name][$parameterName] = sprintf('The "%%s::%s()" method will require a new "%s$%s" argument in the next major version of its parent class "%s", not defining it is deprecated.', $method->name, $parameterType ? $parameterType.' ' : '', $parameterName, $method->class);
+                    self::$annotatedParameters[$class][$method->name][$parameterName] = sprintf('The "%%s::%s()" method will require a new "%s$%s" argument in the next major version of its %s "%s", not defining it is deprecated.', $method->name, $parameterType ? $parameterType.' ' : '', $parameterName, interface_exists($class) ? 'interface' : 'parent class', $method->class);
                 }
             }
         }
diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
index 5ef3cb05c583e..c946607959f6e 100644
--- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
+++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
@@ -292,12 +292,12 @@ class_exists(Fixtures\SubClassWithAnnotatedParameters::class, true);
 
         $this->assertSame([
             'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::quzMethod()" method will require a new "Quz $quz" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\ClassWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::whereAmI()" method will require a new "bool $matrix" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "$noType" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "callable(\Throwable|null $reason, mixed $value) $callback" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "string $param" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "callable  ($a,  $b) $anotherOne" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "Type$WithDollarIsStillAType $ccc" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::whereAmI()" method will require a new "bool $matrix" argument in the next major version of its interface "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "$noType" argument in the next major version of its interface "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "callable(\Throwable|null $reason, mixed $value) $callback" argument in the next major version of its interface "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "string $param" argument in the next major version of its interface "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "callable  ($a,  $b) $anotherOne" argument in the next major version of its interface "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "Type$WithDollarIsStillAType $ccc" argument in the next major version of its interface "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
             'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::isSymfony()" method will require a new "true $yes" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\ClassWithAnnotatedParameters", not defining it is deprecated.',
         ], $deprecations);
     }
diff --git a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
index ce6a86a2ab338..9e410ccc3d636 100644
--- a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
+++ b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
@@ -607,7 +607,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
                     if ($canAddReturnType && 'docblock' === $this->patchTypes['force'] && false === strpos($method->getFileName(), \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR)) {
                         $this->patchMethod($method, $returnType, $declaringFile, $normalizedType);
                     } elseif ('' !== $declaringClass && $this->patchTypes['deprecations']) {
-                        $deprecations[] = sprintf('Method "%s::%s()" will return "%s" as of its next major version. Doing the same in child class "%s" will be required when upgrading.', $declaringClass, $method->name, $normalizedType, $className);
+                        $deprecations[] = sprintf('Method "%s::%s()" will return "%s" as of its next major version. Doing the same in %s "%s" will be required when upgrading.', $declaringClass, $method->name, $normalizedType, interface_exists($declaringClass) ? 'implementation' : 'child class', $className);
                     }
                 }
             }
@@ -664,7 +664,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
             foreach ($matches as list(, $parameterType, $parameterName)) {
                 if (!isset($definedParameters[$parameterName])) {
                     $parameterType = trim($parameterType);
-                    self::$annotatedParameters[$class][$method->name][$parameterName] = sprintf('The "%%s::%s()" method will require a new "%s$%s" argument in the next major version of its parent class "%s", not defining it is deprecated.', $method->name, $parameterType ? $parameterType.' ' : '', $parameterName, $className);
+                    self::$annotatedParameters[$class][$method->name][$parameterName] = sprintf('The "%%s::%s()" method will require a new "%s$%s" argument in the next major version of its %s "%s", not defining it is deprecated.', $method->name, $parameterType ? $parameterType.' ' : '', $parameterName, interface_exists($className) ? 'interface' : 'parent class', $className);
                 }
             }
         }
diff --git a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php
index 5394854738af5..adf55432ee395 100644
--- a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php
+++ b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php
@@ -289,12 +289,12 @@ class_exists(Fixtures\SubClassWithAnnotatedParameters::class, true);
 
         $this->assertSame([
             'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::quzMethod()" method will require a new "Quz $quz" argument in the next major version of its parent class "Symfony\Component\ErrorHandler\Tests\Fixtures\ClassWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::whereAmI()" method will require a new "bool $matrix" argument in the next major version of its parent class "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "$noType" argument in the next major version of its parent class "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "callable(\Throwable|null $reason, mixed $value) $callback" argument in the next major version of its parent class "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "string $param" argument in the next major version of its parent class "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "callable  ($a,  $b) $anotherOne" argument in the next major version of its parent class "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
-            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "Type$WithDollarIsStillAType $ccc" argument in the next major version of its parent class "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::whereAmI()" method will require a new "bool $matrix" argument in the next major version of its interface "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "$noType" argument in the next major version of its interface "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "callable(\Throwable|null $reason, mixed $value) $callback" argument in the next major version of its interface "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "string $param" argument in the next major version of its interface "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "callable  ($a,  $b) $anotherOne" argument in the next major version of its interface "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+            'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "Type$WithDollarIsStillAType $ccc" argument in the next major version of its interface "Symfony\Component\ErrorHandler\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
             'The "Symfony\Component\ErrorHandler\Tests\Fixtures\SubClassWithAnnotatedParameters::isSymfony()" method will require a new "true $yes" argument in the next major version of its parent class "Symfony\Component\ErrorHandler\Tests\Fixtures\ClassWithAnnotatedParameters", not defining it is deprecated.',
         ], $deprecations);
     }
@@ -371,8 +371,8 @@ class_exists('Test\\'.ReturnType::class, true);
 
         $this->assertSame([
            'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeGrandParent::returnTypeGrandParent()" will return "string" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.',
-           'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParentInterface::returnTypeParentInterface()" will return "string" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.',
-           'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeInterface::returnTypeInterface()" will return "string" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.',
+           'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParentInterface::returnTypeParentInterface()" will return "string" as of its next major version. Doing the same in implementation "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.',
+           'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeInterface::returnTypeInterface()" will return "string" as of its next major version. Doing the same in implementation "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.',
            'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::oneNonNullableReturnableType()" will return "void" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.',
            'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::oneNonNullableReturnableTypeWithNull()" will return "void" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.',
            'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::oneNullableReturnableType()" will return "array" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.',
diff --git a/src/Symfony/Component/ErrorHandler/composer.json b/src/Symfony/Component/ErrorHandler/composer.json
index cfe822f4e8b39..614bd4f5ac1f3 100644
--- a/src/Symfony/Component/ErrorHandler/composer.json
+++ b/src/Symfony/Component/ErrorHandler/composer.json
@@ -18,7 +18,7 @@
     "require": {
         "php": "^7.1.3",
         "psr/log": "~1.0",
-        "symfony/debug": "^4.4",
+        "symfony/debug": "^4.4.5",
         "symfony/var-dumper": "^4.4|^5.0"
     },
     "require-dev": {

From a8d0c5b1d7d6af05024f38e9f5dda22c54f33250 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jacek=20J=C4=99drzejewski?=
 
Date: Sun, 23 Feb 2020 20:22:26 +0100
Subject: [PATCH 108/130] Fix bad merge in README of Nexmo Notifier bridge

---
 .../Component/Notifier/Bridge/Nexmo/README.md       | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/src/Symfony/Component/Notifier/Bridge/Nexmo/README.md b/src/Symfony/Component/Notifier/Bridge/Nexmo/README.md
index 6d3314381a112..091c7c73bd972 100644
--- a/src/Symfony/Component/Notifier/Bridge/Nexmo/README.md
+++ b/src/Symfony/Component/Notifier/Bridge/Nexmo/README.md
@@ -3,19 +3,6 @@ Nexmo Notifier
 
 Provides Nexmo integration for Symfony Notifier.
 
-Getting Started
----------------
-
-```
-$ composer install symfony/debug
-```
-
-```php
-use Symfony\Component\Debug\Debug;
-
-Debug::enable();
-```
-
 Resources
 ---------
 

From 3e35fa59ea443616b79eaa3e0e99e924c969db61 Mon Sep 17 00:00:00 2001
From: Thomas Calvet 
Date: Fri, 21 Feb 2020 17:23:44 +0100
Subject: [PATCH 109/130] [DoctrineBridge] Use new Types::* constants and
 support new json type

---
 .../Doctrine/Form/DoctrineOrmTypeGuesser.php  | 39 ++++++-----
 .../PropertyInfo/DoctrineExtractor.php        | 59 +++++++++-------
 .../RememberMe/DoctrineTokenProvider.php      | 13 +++-
 .../PropertyInfo/DoctrineExtractorTest.php    | 69 ++++++++++++-------
 .../PropertyInfo/Fixtures/DoctrineDummy.php   |  2 +-
 .../Fixtures/DoctrineDummy210.php             | 30 ++++++++
 6 files changed, 142 insertions(+), 70 deletions(-)
 create mode 100644 src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy210.php

diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
index ff4b54d24bdcc..4ab64b428c732 100644
--- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
+++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
@@ -15,6 +15,7 @@
 use Doctrine\Common\Persistence\Mapping\MappingException as LegacyCommonMappingException;
 use Doctrine\Common\Util\ClassUtils;
 use Doctrine\DBAL\Types\Type;
+use Doctrine\DBAL\Types\Types;
 use Doctrine\ORM\Mapping\ClassMetadataInfo;
 use Doctrine\ORM\Mapping\MappingException as LegacyMappingException;
 use Doctrine\Persistence\ManagerRegistry;
@@ -30,12 +31,18 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
 
     private $cache = [];
 
+    private static $useDeprecatedConstants;
+
     /**
      * @param ManagerRegistry|LegacyManagerRegistry $registry
      */
     public function __construct($registry)
     {
         $this->registry = $registry;
+
+        if (null === self::$useDeprecatedConstants) {
+            self::$useDeprecatedConstants = !class_exists(Types::class);
+        }
     }
 
     /**
@@ -57,30 +64,30 @@ public function guessType($class, $property)
         }
 
         switch ($metadata->getTypeOfField($property)) {
-            case Type::TARRAY:
+            case self::$useDeprecatedConstants ? Type::TARRAY : 'array':
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', [], Guess::MEDIUM_CONFIDENCE);
-            case Type::BOOLEAN:
+            case self::$useDeprecatedConstants ? Type::BOOLEAN : Types::BOOLEAN:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::HIGH_CONFIDENCE);
-            case Type::DATETIME:
-            case Type::DATETIMETZ:
+            case self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE:
+            case self::$useDeprecatedConstants ? Type::DATETIMETZ : Types::DATETIMETZ_MUTABLE:
             case 'vardatetime':
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', [], Guess::HIGH_CONFIDENCE);
             case 'dateinterval':
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateIntervalType', [], Guess::HIGH_CONFIDENCE);
-            case Type::DATE:
+            case self::$useDeprecatedConstants ? Type::DATE : Types::DATE_MUTABLE:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', [], Guess::HIGH_CONFIDENCE);
-            case Type::TIME:
+            case self::$useDeprecatedConstants ? Type::TIME : Types::TIME_MUTABLE:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', [], Guess::HIGH_CONFIDENCE);
-            case Type::DECIMAL:
-            case Type::FLOAT:
+            case self::$useDeprecatedConstants ? Type::DECIMAL : Types::DECIMAL:
+            case self::$useDeprecatedConstants ? Type::FLOAT : Types::FLOAT:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', [], Guess::MEDIUM_CONFIDENCE);
-            case Type::INTEGER:
-            case Type::BIGINT:
-            case Type::SMALLINT:
+            case self::$useDeprecatedConstants ? Type::INTEGER : Types::INTEGER:
+            case self::$useDeprecatedConstants ? Type::BIGINT : Types::BIGINT:
+            case self::$useDeprecatedConstants ? Type::SMALLINT : Types::SMALLINT:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\IntegerType', [], Guess::MEDIUM_CONFIDENCE);
-            case Type::STRING:
+            case self::$useDeprecatedConstants ? Type::STRING : Types::STRING:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::MEDIUM_CONFIDENCE);
-            case Type::TEXT:
+            case self::$useDeprecatedConstants ? Type::TEXT : Types::TEXT:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextareaType', [], Guess::MEDIUM_CONFIDENCE);
             default:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE);
@@ -103,7 +110,7 @@ public function guessRequired($class, $property)
 
         // Check whether the field exists and is nullable or not
         if (isset($classMetadata->fieldMappings[$property])) {
-            if (!$classMetadata->isNullable($property) && Type::BOOLEAN !== $classMetadata->getTypeOfField($property)) {
+            if (!$classMetadata->isNullable($property) && (self::$useDeprecatedConstants ? Type::BOOLEAN : Types::BOOLEAN) !== $classMetadata->getTypeOfField($property)) {
                 return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
             }
 
@@ -140,7 +147,7 @@ public function guessMaxLength($class, $property)
                 return new ValueGuess($mapping['length'], Guess::HIGH_CONFIDENCE);
             }
 
-            if (\in_array($ret[0]->getTypeOfField($property), [Type::DECIMAL, Type::FLOAT])) {
+            if (\in_array($ret[0]->getTypeOfField($property), self::$useDeprecatedConstants ? [Type::DECIMAL, Type::FLOAT] : [Types::DECIMAL, Types::FLOAT])) {
                 return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
             }
         }
@@ -155,7 +162,7 @@ public function guessPattern($class, $property)
     {
         $ret = $this->getMetadata($class);
         if ($ret && isset($ret[0]->fieldMappings[$property]) && !$ret[0]->hasAssociation($property)) {
-            if (\in_array($ret[0]->getTypeOfField($property), [Type::DECIMAL, Type::FLOAT])) {
+            if (\in_array($ret[0]->getTypeOfField($property), self::$useDeprecatedConstants ? [Type::DECIMAL, Type::FLOAT] : [Types::DECIMAL, Types::FLOAT])) {
                 return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
             }
         }
diff --git a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
index ea96b59f45043..4ceca2c6acae9 100644
--- a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
+++ b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
@@ -14,6 +14,7 @@
 use Doctrine\Common\Persistence\Mapping\ClassMetadataFactory as LegacyClassMetadataFactory;
 use Doctrine\Common\Persistence\Mapping\MappingException as LegacyMappingException;
 use Doctrine\DBAL\Types\Type as DBALType;
+use Doctrine\DBAL\Types\Types;
 use Doctrine\ORM\Mapping\ClassMetadataInfo;
 use Doctrine\ORM\Mapping\MappingException as OrmMappingException;
 use Doctrine\Persistence\Mapping\ClassMetadataFactory;
@@ -31,12 +32,18 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
 {
     private $classMetadataFactory;
 
+    private static $useDeprecatedConstants;
+
     /**
      * @param ClassMetadataFactory|LegacyClassMetadataFactory $classMetadataFactory
      */
     public function __construct($classMetadataFactory)
     {
         $this->classMetadataFactory = $classMetadataFactory;
+
+        if (null === self::$useDeprecatedConstants) {
+            self::$useDeprecatedConstants = !class_exists(Types::class);
+        }
     }
 
     /**
@@ -149,11 +156,11 @@ public function getTypes($class, $property, array $context = [])
             switch ($builtinType) {
                 case Type::BUILTIN_TYPE_OBJECT:
                     switch ($typeOfField) {
-                        case DBALType::DATE:
-                        case DBALType::DATETIME:
-                        case DBALType::DATETIMETZ:
+                        case self::$useDeprecatedConstants ? DBALType::DATE : Types::DATE_MUTABLE:
+                        case self::$useDeprecatedConstants ? DBALType::DATETIME : Types::DATETIME_MUTABLE:
+                        case self::$useDeprecatedConstants ? DBALType::DATETIMETZ : Types::DATETIMETZ_MUTABLE:
                         case 'vardatetime':
-                        case DBALType::TIME:
+                        case self::$useDeprecatedConstants ? DBALType::TIME : Types::TIME_MUTABLE:
                             return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTime')];
 
                         case 'date_immutable':
@@ -169,11 +176,12 @@ public function getTypes($class, $property, array $context = [])
                     break;
                 case Type::BUILTIN_TYPE_ARRAY:
                     switch ($typeOfField) {
-                        case DBALType::TARRAY:
-                        case DBALType::JSON_ARRAY:
+                        case self::$useDeprecatedConstants ? DBALType::TARRAY : 'array':
+                        case 'json_array':
+                        case self::$useDeprecatedConstants ? false : Types::JSON:
                             return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
 
-                        case DBALType::SIMPLE_ARRAY:
+                        case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
                             return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING))];
                     }
             }
@@ -221,33 +229,33 @@ private function isAssociationNullable(array $associationMapping)
     private function getPhpType($doctrineType)
     {
         switch ($doctrineType) {
-            case DBALType::SMALLINT:
-            case DBALType::INTEGER:
+            case self::$useDeprecatedConstants ? DBALType::SMALLINT : Types::SMALLINT:
+            case self::$useDeprecatedConstants ? DBALType::INTEGER : Types::INTEGER:
                 return Type::BUILTIN_TYPE_INT;
 
-            case DBALType::FLOAT:
+            case self::$useDeprecatedConstants ? DBALType::FLOAT : Types::FLOAT:
                 return Type::BUILTIN_TYPE_FLOAT;
 
-            case DBALType::BIGINT:
-            case DBALType::STRING:
-            case DBALType::TEXT:
-            case DBALType::GUID:
-            case DBALType::DECIMAL:
+            case self::$useDeprecatedConstants ? DBALType::BIGINT : Types::BIGINT:
+            case self::$useDeprecatedConstants ? DBALType::STRING : Types::STRING:
+            case self::$useDeprecatedConstants ? DBALType::TEXT : Types::TEXT:
+            case self::$useDeprecatedConstants ? DBALType::GUID : Types::GUID:
+            case self::$useDeprecatedConstants ? DBALType::DECIMAL : Types::DECIMAL:
                 return Type::BUILTIN_TYPE_STRING;
 
-            case DBALType::BOOLEAN:
+            case self::$useDeprecatedConstants ? DBALType::BOOLEAN : Types::BOOLEAN:
                 return Type::BUILTIN_TYPE_BOOL;
 
-            case DBALType::BLOB:
+            case self::$useDeprecatedConstants ? DBALType::BLOB : Types::BLOB:
             case 'binary':
                 return Type::BUILTIN_TYPE_RESOURCE;
 
-            case DBALType::OBJECT:
-            case DBALType::DATE:
-            case DBALType::DATETIME:
-            case DBALType::DATETIMETZ:
+            case self::$useDeprecatedConstants ? DBALType::OBJECT : Types::OBJECT:
+            case self::$useDeprecatedConstants ? DBALType::DATE : Types::DATE_MUTABLE:
+            case self::$useDeprecatedConstants ? DBALType::DATETIME : Types::DATETIME_MUTABLE:
+            case self::$useDeprecatedConstants ? DBALType::DATETIMETZ : Types::DATETIMETZ_MUTABLE:
             case 'vardatetime':
-            case DBALType::TIME:
+            case self::$useDeprecatedConstants ? DBALType::TIME : Types::TIME_MUTABLE:
             case 'date_immutable':
             case 'datetime_immutable':
             case 'datetimetz_immutable':
@@ -255,9 +263,10 @@ private function getPhpType($doctrineType)
             case 'dateinterval':
                 return Type::BUILTIN_TYPE_OBJECT;
 
-            case DBALType::TARRAY:
-            case DBALType::SIMPLE_ARRAY:
-            case DBALType::JSON_ARRAY:
+            case self::$useDeprecatedConstants ? DBALType::TARRAY : 'array':
+            case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
+            case 'json_array':
+            case self::$useDeprecatedConstants ? false : Types::JSON:
                 return Type::BUILTIN_TYPE_ARRAY;
         }
 
diff --git a/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php b/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php
index 64515fac71840..ef0612df3128f 100644
--- a/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php
+++ b/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php
@@ -12,7 +12,8 @@
 namespace Symfony\Bridge\Doctrine\Security\RememberMe;
 
 use Doctrine\DBAL\Connection;
-use Doctrine\DBAL\Types\Type as DoctrineType;
+use Doctrine\DBAL\Types\Type;
+use Doctrine\DBAL\Types\Types;
 use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken;
 use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentTokenInterface;
 use Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface;
@@ -40,9 +41,15 @@ class DoctrineTokenProvider implements TokenProviderInterface
 {
     private $conn;
 
+    private static $useDeprecatedConstants;
+
     public function __construct(Connection $conn)
     {
         $this->conn = $conn;
+
+        if (null === self::$useDeprecatedConstants) {
+            self::$useDeprecatedConstants = !class_exists(Types::class);
+        }
     }
 
     /**
@@ -90,7 +97,7 @@ public function updateToken($series, $tokenValue, \DateTime $lastUsed)
         ];
         $paramTypes = [
             'value' => \PDO::PARAM_STR,
-            'lastUsed' => DoctrineType::DATETIME,
+            'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
             'series' => \PDO::PARAM_STR,
         ];
         $updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
@@ -119,7 +126,7 @@ public function createNewToken(PersistentTokenInterface $token)
             'username' => \PDO::PARAM_STR,
             'series' => \PDO::PARAM_STR,
             'value' => \PDO::PARAM_STR,
-            'lastUsed' => DoctrineType::DATETIME,
+            'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
         ];
         $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
     }
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
index 9c658a324613c..c4efb6c936106 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
@@ -13,10 +13,12 @@
 
 use Doctrine\Common\Collections\Collection;
 use Doctrine\DBAL\Types\Type as DBALType;
+use Doctrine\DBAL\Types\Types;
 use Doctrine\ORM\EntityManager;
 use Doctrine\ORM\Tools\Setup;
 use PHPUnit\Framework\TestCase;
 use Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor;
+use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy210;
 use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation;
 use Symfony\Component\PropertyInfo\Type;
 
@@ -45,29 +47,40 @@ protected function setUp()
 
     public function testGetProperties()
     {
+        // Fields
+        $expected = [
+            'id',
+            'guid',
+            'time',
+            'timeImmutable',
+            'dateInterval',
+            'jsonArray',
+            'simpleArray',
+            'float',
+            'decimal',
+            'bool',
+            'binary',
+            'customFoo',
+            'bigint',
+        ];
+
+        if (class_exists(Types::class)) {
+            $expected[] = 'json';
+        }
+
+        // Associations
+        $expected = array_merge($expected, [
+            'foo',
+            'bar',
+            'indexedBar',
+            'indexedFoo',
+            'indexedByDt',
+            'indexedByCustomType',
+        ]);
+
         $this->assertEquals(
-             [
-                'id',
-                'guid',
-                'time',
-                'timeImmutable',
-                'dateInterval',
-                'json',
-                'simpleArray',
-                'float',
-                'decimal',
-                'bool',
-                'binary',
-                'customFoo',
-                'bigint',
-                'foo',
-                'bar',
-                'indexedBar',
-                'indexedFoo',
-                'indexedByDt',
-                'indexedByCustomType',
-            ],
-            $this->extractor->getProperties('Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy')
+            $expected,
+            $this->extractor->getProperties(!class_exists(Types::class) ? 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy' : DoctrineDummy210::class)
         );
     }
 
@@ -91,7 +104,7 @@ public function testGetPropertiesWithEmbedded()
      */
     public function testExtract($property, array $type = null)
     {
-        $this->assertEquals($type, $this->extractor->getTypes('Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy', $property, []));
+        $this->assertEquals($type, $this->extractor->getTypes(!class_exists(Types::class) ? 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy' : DoctrineDummy210::class, $property, []));
     }
 
     public function testExtractWithEmbedded()
@@ -117,7 +130,7 @@ public function testExtractWithEmbedded()
 
     public function typesProvider()
     {
-        return [
+        $provider = [
             ['id', [new Type(Type::BUILTIN_TYPE_INT)]],
             ['guid', [new Type(Type::BUILTIN_TYPE_STRING)]],
             ['bigint', [new Type(Type::BUILTIN_TYPE_STRING)]],
@@ -128,7 +141,7 @@ public function typesProvider()
             ['decimal', [new Type(Type::BUILTIN_TYPE_STRING)]],
             ['bool', [new Type(Type::BUILTIN_TYPE_BOOL)]],
             ['binary', [new Type(Type::BUILTIN_TYPE_RESOURCE)]],
-            ['json', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true)]],
+            ['jsonArray', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true)]],
             ['foo', [new Type(Type::BUILTIN_TYPE_OBJECT, true, 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation')]],
             ['bar', [new Type(
                 Type::BUILTIN_TYPE_OBJECT,
@@ -167,6 +180,12 @@ public function typesProvider()
             )]],
             ['indexedByCustomType', null],
         ];
+
+        if (class_exists(Types::class)) {
+            $provider[] = ['json', [new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)]];
+        }
+
+        return $provider;
     }
 
     public function testGetPropertiesCatchException()
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
index c8bd04e4ec5f4..81264fad27c5f 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
@@ -74,7 +74,7 @@ class DoctrineDummy
     /**
      * @Column(type="json_array")
      */
-    private $json;
+    private $jsonArray;
 
     /**
      * @Column(type="simple_array")
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy210.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy210.php
new file mode 100644
index 0000000000000..d3916143deab7
--- /dev/null
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy210.php
@@ -0,0 +1,30 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures;
+
+use Doctrine\ORM\Mapping\Column;
+use Doctrine\ORM\Mapping\Entity;
+use Doctrine\ORM\Mapping\Id;
+use Doctrine\ORM\Mapping\ManyToMany;
+use Doctrine\ORM\Mapping\ManyToOne;
+use Doctrine\ORM\Mapping\OneToMany;
+
+/**
+ * @Entity
+ */
+final class DoctrineDummy210 extends DoctrineDummy
+{
+    /**
+     * @Column(type="json", nullable=true)
+     */
+    private $json;
+}

From f1fb1597ff4a708a4e845b9d2f1a23a92839919e Mon Sep 17 00:00:00 2001
From: Thomas Calvet 
Date: Fri, 21 Feb 2020 17:48:38 +0100
Subject: [PATCH 110/130] [Messenger] Use Doctrine DBAL new Types::* constants

---
 .../Transport/Doctrine/Connection.php         | 36 +++++++++++++------
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php b/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php
index 2b4017e946ce5..b700ca2f334d3 100644
--- a/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php
+++ b/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php
@@ -20,6 +20,7 @@
 use Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer;
 use Doctrine\DBAL\Schema\Synchronizer\SingleDatabaseSynchronizer;
 use Doctrine\DBAL\Types\Type;
+use Doctrine\DBAL\Types\Types;
 use Symfony\Component\Messenger\Exception\InvalidArgumentException;
 use Symfony\Component\Messenger\Exception\TransportException;
 
@@ -53,12 +54,18 @@ class Connection
     private $schemaSynchronizer;
     private $autoSetup;
 
+    private static $useDeprecatedConstants;
+
     public function __construct(array $configuration, DBALConnection $driverConnection, SchemaSynchronizer $schemaSynchronizer = null)
     {
         $this->configuration = array_replace_recursive(self::DEFAULT_OPTIONS, $configuration);
         $this->driverConnection = $driverConnection;
         $this->schemaSynchronizer = $schemaSynchronizer ?? new SingleDatabaseSynchronizer($this->driverConnection);
         $this->autoSetup = $this->configuration['auto_setup'];
+
+        if (null === self::$useDeprecatedConstants) {
+            self::$useDeprecatedConstants = !class_exists(Types::class);
+        }
     }
 
     public function getConfiguration(): array
@@ -125,12 +132,18 @@ public function send(string $body, array $headers, int $delay = 0): string
             $this->configuration['queue_name'],
             $now,
             $availableAt,
-        ], [
+        ], self::$useDeprecatedConstants ? [
             null,
             null,
             null,
             Type::DATETIME,
             Type::DATETIME,
+        ] : [
+            null,
+            null,
+            null,
+            Types::DATETIME_MUTABLE,
+            Types::DATETIME_MUTABLE,
         ]);
 
         return $this->driverConnection->lastInsertId();
@@ -169,7 +182,7 @@ public function get(): ?array
                 $now,
                 $doctrineEnvelope['id'],
             ], [
-                Type::DATETIME,
+                self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
             ]);
 
             $this->driverConnection->commit();
@@ -278,9 +291,12 @@ private function createAvailableMessagesQueryBuilder(): QueryBuilder
                 $redeliverLimit,
                 $now,
                 $this->configuration['queue_name'],
-            ], [
+            ], self::$useDeprecatedConstants ? [
                 Type::DATETIME,
                 Type::DATETIME,
+            ] : [
+                Types::DATETIME_MUTABLE,
+                Types::DATETIME_MUTABLE,
             ]);
     }
 
@@ -314,20 +330,20 @@ private function getSchema(): Schema
     {
         $schema = new Schema([], [], $this->driverConnection->getSchemaManager()->createSchemaConfig());
         $table = $schema->createTable($this->configuration['table_name']);
-        $table->addColumn('id', Type::BIGINT)
+        $table->addColumn('id', self::$useDeprecatedConstants ? Type::BIGINT : Types::BIGINT)
             ->setAutoincrement(true)
             ->setNotnull(true);
-        $table->addColumn('body', Type::TEXT)
+        $table->addColumn('body', self::$useDeprecatedConstants ? Type::TEXT : Types::TEXT)
             ->setNotnull(true);
-        $table->addColumn('headers', Type::TEXT)
+        $table->addColumn('headers', self::$useDeprecatedConstants ? Type::TEXT : Types::TEXT)
             ->setNotnull(true);
-        $table->addColumn('queue_name', Type::STRING)
+        $table->addColumn('queue_name', self::$useDeprecatedConstants ? Type::STRING : Types::STRING)
             ->setNotnull(true);
-        $table->addColumn('created_at', Type::DATETIME)
+        $table->addColumn('created_at', self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE)
             ->setNotnull(true);
-        $table->addColumn('available_at', Type::DATETIME)
+        $table->addColumn('available_at', self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE)
             ->setNotnull(true);
-        $table->addColumn('delivered_at', Type::DATETIME)
+        $table->addColumn('delivered_at', self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE)
             ->setNotnull(false);
         $table->setPrimaryKey(['id']);
         $table->addIndex(['queue_name']);

From 847d6dc8f367135a10bc783c8890eddf170f4f50 Mon Sep 17 00:00:00 2001
From: Christian Flothmann 
Date: Mon, 24 Feb 2020 15:33:45 +0100
Subject: [PATCH 111/130] prevent method calls on null values

---
 .../Component/Serializer/Encoder/XmlEncoder.php       | 11 ++++++++++-
 .../Serializer/Normalizer/ArrayDenormalizer.php       |  4 ++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
index c1e1109130479..dada438e29d73 100644
--- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
+++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Serializer\Encoder;
 
+use Symfony\Component\Serializer\Exception\BadMethodCallException;
 use Symfony\Component\Serializer\Exception\NotEncodableValueException;
 
 /**
@@ -375,7 +376,7 @@ private function buildXml(\DOMNode $parentNode, $data, $xmlRootNodeName = null)
     {
         $append = true;
 
-        if (\is_array($data) || ($data instanceof \Traversable && !$this->serializer->supportsNormalization($data, $this->format))) {
+        if (\is_array($data) || ($data instanceof \Traversable && (null === $this->serializer || !$this->serializer->supportsNormalization($data, $this->format)))) {
             foreach ($data as $key => $data) {
                 //Ah this is the magic @ attribute types.
                 if (0 === strpos($key, '@') && $this->isElementNameValid($attributeName = substr($key, 1))) {
@@ -410,6 +411,10 @@ private function buildXml(\DOMNode $parentNode, $data, $xmlRootNodeName = null)
         }
 
         if (\is_object($data)) {
+            if (null === $this->serializer) {
+                throw new BadMethodCallException(sprintf('The serializer needs to be set to allow %s() to be used with object data.', __METHOD__));
+            }
+
             $data = $this->serializer->normalize($data, $this->format, $this->context);
             if (null !== $data && !is_scalar($data)) {
                 return $this->buildXml($parentNode, $data, $xmlRootNodeName);
@@ -484,6 +489,10 @@ private function selectNodeType(\DOMNode $node, $val)
         } elseif ($val instanceof \Traversable) {
             $this->buildXml($node, $val);
         } elseif (\is_object($val)) {
+            if (null === $this->serializer) {
+                throw new BadMethodCallException(sprintf('The serializer needs to be set to allow %s() to be used with object data.', __METHOD__));
+            }
+
             return $this->selectNodeType($node, $this->serializer->normalize($val, $this->format, $this->context));
         } elseif (is_numeric($val)) {
             return $this->appendText($node, (string) $val);
diff --git a/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php
index 93d6fc009b335..702b8bfecdfa6 100644
--- a/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php
@@ -68,6 +68,10 @@ public function denormalize($data, $type, $format = null, array $context = [])
      */
     public function supportsDenormalization($data, $type, $format = null/*, array $context = []*/)
     {
+        if (null === $this->serializer) {
+            throw new BadMethodCallException(sprintf('The serializer needs to be set to allow %s() to be used.', __METHOD__));
+        }
+
         $context = \func_num_args() > 3 ? func_get_arg(3) : [];
 
         return '[]' === substr($type, -2)

From a0d99ce39896bfc2b5a617ea1839597192409b27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Sch=C3=A4dlich?= 
Date: Mon, 24 Feb 2020 09:43:05 +0100
Subject: [PATCH 112/130] [Notifier] Dispatch message event in null transport

---
 .../Component/Notifier/Transport/NullTransport.php | 14 ++++++++++++++
 .../Notifier/Transport/NullTransportFactory.php    |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Notifier/Transport/NullTransport.php b/src/Symfony/Component/Notifier/Transport/NullTransport.php
index 658243ae7d539..4973fbba2cddd 100644
--- a/src/Symfony/Component/Notifier/Transport/NullTransport.php
+++ b/src/Symfony/Component/Notifier/Transport/NullTransport.php
@@ -11,7 +11,11 @@
 
 namespace Symfony\Component\Notifier\Transport;
 
+use Symfony\Component\EventDispatcher\Event;
+use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
+use Symfony\Component\Notifier\Event\MessageEvent;
 use Symfony\Component\Notifier\Message\MessageInterface;
+use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
 
 /**
  * @author Fabien Potencier 
@@ -20,8 +24,18 @@
  */
 class NullTransport implements TransportInterface
 {
+    private $dispatcher;
+
+    public function __construct(EventDispatcherInterface $dispatcher = null)
+    {
+        $this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
+    }
+
     public function send(MessageInterface $message): void
     {
+        if (null !== $this->dispatcher) {
+            $this->dispatcher->dispatch(new MessageEvent($message));
+        }
     }
 
     public function __toString(): string
diff --git a/src/Symfony/Component/Notifier/Transport/NullTransportFactory.php b/src/Symfony/Component/Notifier/Transport/NullTransportFactory.php
index abfcd1c75d3f7..196d052a05163 100644
--- a/src/Symfony/Component/Notifier/Transport/NullTransportFactory.php
+++ b/src/Symfony/Component/Notifier/Transport/NullTransportFactory.php
@@ -26,7 +26,7 @@ final class NullTransportFactory extends AbstractTransportFactory
     public function create(Dsn $dsn): TransportInterface
     {
         if ('null' === $dsn->getScheme()) {
-            return new NullTransport();
+            return new NullTransport($this->dispatcher);
         }
 
         throw new UnsupportedSchemeException($dsn, 'null', $this->getSupportedSchemes());

From d7250ef620cf2c46c6a27280be7e1b28b289f873 Mon Sep 17 00:00:00 2001
From: Fabien Potencier 
Date: Mon, 24 Feb 2020 18:11:18 +0100
Subject: [PATCH 113/130] [Validator] Add missing translations

---
 .../Validator/Resources/translations/validators.en.xlf        | 4 ++++
 .../Validator/Resources/translations/validators.fr.xlf        | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf
index 635e6736f6941..8f8d2d0a0fe98 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf
@@ -370,6 +370,10 @@
                 This value is not a valid hostname.
                 This value is not a valid hostname.
             
+            
+                The number of elements in this collection should be a multiple of {{ compared_value }}.
+                The number of elements in this collection should be a multiple of {{ compared_value }}.
+            
         
     
 
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf
index 4a7ab3538c41a..e54be35c15cca 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf
@@ -370,6 +370,10 @@
                 This value is not a valid hostname.
                 Cette valeur n'est pas un nom d'hôte valide.
             
+            
+                The number of elements in this collection should be a multiple of {{ compared_value }}.
+                Le nombre d'éléments de cette collection doit être un multiple de {{ compared_value }}.
+            
         
     
 

From ddf33535d0ea4f4d1ac3cc88339958cf3cc1f3e2 Mon Sep 17 00:00:00 2001
From: Thomas Calvet 
Date: Mon, 24 Feb 2020 18:16:47 +0100
Subject: [PATCH 114/130] [4.4][DoctrineBridge] Use new Types::* constants and
 support new json type

---
 .../Doctrine/Form/DoctrineOrmTypeGuesser.php  | 41 ++++++-----
 .../PropertyInfo/DoctrineExtractor.php        | 59 +++++++++-------
 .../RememberMe/DoctrineTokenProvider.php      | 13 +++-
 .../PropertyInfo/DoctrineExtractorTest.php    | 69 ++++++++++++-------
 .../PropertyInfo/Fixtures/DoctrineDummy.php   |  2 +-
 5 files changed, 113 insertions(+), 71 deletions(-)

diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
index 6b097087b1e23..7c866f3d4185f 100644
--- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
+++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
@@ -12,6 +12,7 @@
 namespace Symfony\Bridge\Doctrine\Form;
 
 use Doctrine\DBAL\Types\Type;
+use Doctrine\DBAL\Types\Types;
 use Doctrine\ORM\Mapping\ClassMetadataInfo;
 use Doctrine\ORM\Mapping\MappingException as LegacyMappingException;
 use Doctrine\Persistence\ManagerRegistry;
@@ -28,9 +29,15 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
 
     private $cache = [];
 
+    private static $useDeprecatedConstants;
+
     public function __construct(ManagerRegistry $registry)
     {
         $this->registry = $registry;
+
+        if (null === self::$useDeprecatedConstants) {
+            self::$useDeprecatedConstants = !class_exists(Types::class);
+        }
     }
 
     /**
@@ -52,13 +59,13 @@ public function guessType($class, $property)
         }
 
         switch ($metadata->getTypeOfField($property)) {
-            case Type::TARRAY:
-            case Type::SIMPLE_ARRAY:
+            case self::$useDeprecatedConstants ? Type::TARRAY : Types::ARRAY:
+            case self::$useDeprecatedConstants ? Type::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', [], Guess::MEDIUM_CONFIDENCE);
-            case Type::BOOLEAN:
+            case self::$useDeprecatedConstants ? Type::BOOLEAN : Types::BOOLEAN:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::HIGH_CONFIDENCE);
-            case Type::DATETIME:
-            case Type::DATETIMETZ:
+            case self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE:
+            case self::$useDeprecatedConstants ? Type::DATETIMETZ : Types::DATETIMETZ_MUTABLE:
             case 'vardatetime':
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', [], Guess::HIGH_CONFIDENCE);
             case 'datetime_immutable':
@@ -66,25 +73,25 @@ public function guessType($class, $property)
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE);
             case 'dateinterval':
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateIntervalType', [], Guess::HIGH_CONFIDENCE);
-            case Type::DATE:
+            case self::$useDeprecatedConstants ? Type::DATE : Types::DATE_MUTABLE:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', [], Guess::HIGH_CONFIDENCE);
             case 'date_immutable':
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE);
-            case Type::TIME:
+            case self::$useDeprecatedConstants ? Type::TIME : Types::TIME_MUTABLE:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', [], Guess::HIGH_CONFIDENCE);
             case 'time_immutable':
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE);
-            case Type::DECIMAL:
+            case self::$useDeprecatedConstants ? Type::DECIMAL : Types::DECIMAL:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', ['input' => 'string'], Guess::MEDIUM_CONFIDENCE);
-            case Type::FLOAT:
+            case self::$useDeprecatedConstants ? Type::FLOAT : Types::FLOAT:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', [], Guess::MEDIUM_CONFIDENCE);
-            case Type::INTEGER:
-            case Type::BIGINT:
-            case Type::SMALLINT:
+            case self::$useDeprecatedConstants ? Type::INTEGER : Types::INTEGER:
+            case self::$useDeprecatedConstants ? Type::BIGINT : Types::BIGINT:
+            case self::$useDeprecatedConstants ? Type::SMALLINT : Types::SMALLINT:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\IntegerType', [], Guess::MEDIUM_CONFIDENCE);
-            case Type::STRING:
+            case self::$useDeprecatedConstants ? Type::STRING : Types::STRING:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::MEDIUM_CONFIDENCE);
-            case Type::TEXT:
+            case self::$useDeprecatedConstants ? Type::TEXT : Types::TEXT:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextareaType', [], Guess::MEDIUM_CONFIDENCE);
             default:
                 return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE);
@@ -107,7 +114,7 @@ public function guessRequired($class, $property)
 
         // Check whether the field exists and is nullable or not
         if (isset($classMetadata->fieldMappings[$property])) {
-            if (!$classMetadata->isNullable($property) && Type::BOOLEAN !== $classMetadata->getTypeOfField($property)) {
+            if (!$classMetadata->isNullable($property) && (self::$useDeprecatedConstants ? Type::BOOLEAN : Types::BOOLEAN) !== $classMetadata->getTypeOfField($property)) {
                 return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
             }
 
@@ -144,7 +151,7 @@ public function guessMaxLength($class, $property)
                 return new ValueGuess($mapping['length'], Guess::HIGH_CONFIDENCE);
             }
 
-            if (\in_array($ret[0]->getTypeOfField($property), [Type::DECIMAL, Type::FLOAT])) {
+            if (\in_array($ret[0]->getTypeOfField($property), self::$useDeprecatedConstants ? [Type::DECIMAL, Type::FLOAT] : [Types::DECIMAL, Types::FLOAT])) {
                 return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
             }
         }
@@ -159,7 +166,7 @@ public function guessPattern($class, $property)
     {
         $ret = $this->getMetadata($class);
         if ($ret && isset($ret[0]->fieldMappings[$property]) && !$ret[0]->hasAssociation($property)) {
-            if (\in_array($ret[0]->getTypeOfField($property), [Type::DECIMAL, Type::FLOAT])) {
+            if (\in_array($ret[0]->getTypeOfField($property), self::$useDeprecatedConstants ? [Type::DECIMAL, Type::FLOAT] : [Types::DECIMAL, Types::FLOAT])) {
                 return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
             }
         }
diff --git a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
index a3471926cbcab..d0e0c765bc3bd 100644
--- a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
+++ b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
@@ -12,6 +12,7 @@
 namespace Symfony\Bridge\Doctrine\PropertyInfo;
 
 use Doctrine\DBAL\Types\Type as DBALType;
+use Doctrine\DBAL\Types\Types;
 use Doctrine\ORM\EntityManagerInterface;
 use Doctrine\ORM\Mapping\ClassMetadata;
 use Doctrine\ORM\Mapping\ClassMetadataInfo;
@@ -33,6 +34,8 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
     private $entityManager;
     private $classMetadataFactory;
 
+    private static $useDeprecatedConstants;
+
     /**
      * @param EntityManagerInterface $entityManager
      */
@@ -46,6 +49,10 @@ public function __construct($entityManager)
         } else {
             throw new \TypeError(sprintf('$entityManager must be an instance of "%s", "%s" given.', EntityManagerInterface::class, \is_object($entityManager) ? \get_class($entityManager) : \gettype($entityManager)));
         }
+
+        if (null === self::$useDeprecatedConstants) {
+            self::$useDeprecatedConstants = !class_exists(Types::class);
+        }
     }
 
     /**
@@ -146,11 +153,11 @@ public function getTypes($class, $property, array $context = [])
             switch ($builtinType) {
                 case Type::BUILTIN_TYPE_OBJECT:
                     switch ($typeOfField) {
-                        case DBALType::DATE:
-                        case DBALType::DATETIME:
-                        case DBALType::DATETIMETZ:
+                        case self::$useDeprecatedConstants ? DBALType::DATE : Types::DATE_MUTABLE:
+                        case self::$useDeprecatedConstants ? DBALType::DATETIME : Types::DATETIME_MUTABLE:
+                        case self::$useDeprecatedConstants ? DBALType::DATETIMETZ : Types::DATETIMETZ_MUTABLE:
                         case 'vardatetime':
-                        case DBALType::TIME:
+                        case self::$useDeprecatedConstants ? DBALType::TIME : Types::TIME_MUTABLE:
                             return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTime')];
 
                         case 'date_immutable':
@@ -166,11 +173,12 @@ public function getTypes($class, $property, array $context = [])
                     break;
                 case Type::BUILTIN_TYPE_ARRAY:
                     switch ($typeOfField) {
-                        case DBALType::TARRAY:
-                        case DBALType::JSON_ARRAY:
+                        case self::$useDeprecatedConstants ? DBALType::TARRAY : Types::ARRAY:
+                        case 'json_array':
+                        case self::$useDeprecatedConstants ? false : Types::JSON:
                             return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
 
-                        case DBALType::SIMPLE_ARRAY:
+                        case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
                             return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING))];
                     }
             }
@@ -245,33 +253,33 @@ private function isAssociationNullable(array $associationMapping): bool
     private function getPhpType(string $doctrineType): ?string
     {
         switch ($doctrineType) {
-            case DBALType::SMALLINT:
-            case DBALType::INTEGER:
+            case self::$useDeprecatedConstants ? DBALType::SMALLINT : Types::SMALLINT:
+            case self::$useDeprecatedConstants ? DBALType::INTEGER : Types::INTEGER:
                 return Type::BUILTIN_TYPE_INT;
 
-            case DBALType::FLOAT:
+            case self::$useDeprecatedConstants ? DBALType::FLOAT : Types::FLOAT:
                 return Type::BUILTIN_TYPE_FLOAT;
 
-            case DBALType::BIGINT:
-            case DBALType::STRING:
-            case DBALType::TEXT:
-            case DBALType::GUID:
-            case DBALType::DECIMAL:
+            case self::$useDeprecatedConstants ? DBALType::BIGINT : Types::BIGINT:
+            case self::$useDeprecatedConstants ? DBALType::STRING : Types::STRING:
+            case self::$useDeprecatedConstants ? DBALType::TEXT : Types::TEXT:
+            case self::$useDeprecatedConstants ? DBALType::GUID : Types::GUID:
+            case self::$useDeprecatedConstants ? DBALType::DECIMAL : Types::DECIMAL:
                 return Type::BUILTIN_TYPE_STRING;
 
-            case DBALType::BOOLEAN:
+            case self::$useDeprecatedConstants ? DBALType::BOOLEAN : Types::BOOLEAN:
                 return Type::BUILTIN_TYPE_BOOL;
 
-            case DBALType::BLOB:
+            case self::$useDeprecatedConstants ? DBALType::BLOB : Types::BLOB:
             case 'binary':
                 return Type::BUILTIN_TYPE_RESOURCE;
 
-            case DBALType::OBJECT:
-            case DBALType::DATE:
-            case DBALType::DATETIME:
-            case DBALType::DATETIMETZ:
+            case self::$useDeprecatedConstants ? DBALType::OBJECT : Types::OBJECT:
+            case self::$useDeprecatedConstants ? DBALType::DATE : Types::DATE_MUTABLE:
+            case self::$useDeprecatedConstants ? DBALType::DATETIME : Types::DATETIME_MUTABLE:
+            case self::$useDeprecatedConstants ? DBALType::DATETIMETZ : Types::DATETIMETZ_MUTABLE:
             case 'vardatetime':
-            case DBALType::TIME:
+            case self::$useDeprecatedConstants ? DBALType::TIME : Types::TIME_MUTABLE:
             case 'date_immutable':
             case 'datetime_immutable':
             case 'datetimetz_immutable':
@@ -279,9 +287,10 @@ private function getPhpType(string $doctrineType): ?string
             case 'dateinterval':
                 return Type::BUILTIN_TYPE_OBJECT;
 
-            case DBALType::TARRAY:
-            case DBALType::SIMPLE_ARRAY:
-            case DBALType::JSON_ARRAY:
+            case self::$useDeprecatedConstants ? DBALType::TARRAY : Types::ARRAY:
+            case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY:
+            case 'json_array':
+            case self::$useDeprecatedConstants ? false : Types::JSON:
                 return Type::BUILTIN_TYPE_ARRAY;
         }
 
diff --git a/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php b/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php
index 64515fac71840..ef0612df3128f 100644
--- a/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php
+++ b/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php
@@ -12,7 +12,8 @@
 namespace Symfony\Bridge\Doctrine\Security\RememberMe;
 
 use Doctrine\DBAL\Connection;
-use Doctrine\DBAL\Types\Type as DoctrineType;
+use Doctrine\DBAL\Types\Type;
+use Doctrine\DBAL\Types\Types;
 use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken;
 use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentTokenInterface;
 use Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface;
@@ -40,9 +41,15 @@ class DoctrineTokenProvider implements TokenProviderInterface
 {
     private $conn;
 
+    private static $useDeprecatedConstants;
+
     public function __construct(Connection $conn)
     {
         $this->conn = $conn;
+
+        if (null === self::$useDeprecatedConstants) {
+            self::$useDeprecatedConstants = !class_exists(Types::class);
+        }
     }
 
     /**
@@ -90,7 +97,7 @@ public function updateToken($series, $tokenValue, \DateTime $lastUsed)
         ];
         $paramTypes = [
             'value' => \PDO::PARAM_STR,
-            'lastUsed' => DoctrineType::DATETIME,
+            'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
             'series' => \PDO::PARAM_STR,
         ];
         $updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
@@ -119,7 +126,7 @@ public function createNewToken(PersistentTokenInterface $token)
             'username' => \PDO::PARAM_STR,
             'series' => \PDO::PARAM_STR,
             'value' => \PDO::PARAM_STR,
-            'lastUsed' => DoctrineType::DATETIME,
+            'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
         ];
         $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
     }
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
index 4cb0e089ccfd7..3df655df12a28 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
@@ -13,10 +13,12 @@
 
 use Doctrine\Common\Collections\Collection;
 use Doctrine\DBAL\Types\Type as DBALType;
+use Doctrine\DBAL\Types\Types;
 use Doctrine\ORM\EntityManager;
 use Doctrine\ORM\Tools\Setup;
 use PHPUnit\Framework\TestCase;
 use Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor;
+use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy210;
 use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineGeneratedValue;
 use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation;
 use Symfony\Component\PropertyInfo\Type;
@@ -51,29 +53,40 @@ public function testLegacyGetProperties()
 
     private function doTestGetProperties(bool $legacy)
     {
+        // Fields
+        $expected = [
+            'id',
+            'guid',
+            'time',
+            'timeImmutable',
+            'dateInterval',
+            'jsonArray',
+            'simpleArray',
+            'float',
+            'decimal',
+            'bool',
+            'binary',
+            'customFoo',
+            'bigint',
+        ];
+
+        if (class_exists(Types::class)) {
+            $expected[] = 'json';
+        }
+
+        // Associations
+        $expected = array_merge($expected, [
+            'foo',
+            'bar',
+            'indexedBar',
+            'indexedFoo',
+            'indexedByDt',
+            'indexedByCustomType',
+        ]);
+
         $this->assertEquals(
-             [
-                'id',
-                'guid',
-                'time',
-                'timeImmutable',
-                'dateInterval',
-                'json',
-                'simpleArray',
-                'float',
-                'decimal',
-                'bool',
-                'binary',
-                'customFoo',
-                'bigint',
-                'foo',
-                'bar',
-                'indexedBar',
-                'indexedFoo',
-                'indexedByDt',
-                'indexedByCustomType',
-            ],
-            $this->createExtractor($legacy)->getProperties('Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy')
+            $expected,
+            $this->createExtractor($legacy)->getProperties(!class_exists(Types::class) ? 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy' : DoctrineDummy210::class)
         );
     }
 
@@ -120,7 +133,7 @@ public function testLegacyExtract($property, array $type = null)
 
     private function doTestExtract(bool $legacy, $property, array $type = null)
     {
-        $this->assertEquals($type, $this->createExtractor($legacy)->getTypes('Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy', $property, []));
+        $this->assertEquals($type, $this->createExtractor($legacy)->getTypes(!class_exists(Types::class) ? 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy' : DoctrineDummy210::class, $property, []));
     }
 
     public function testExtractWithEmbedded()
@@ -156,7 +169,7 @@ private function doTestExtractWithEmbedded(bool $legacy)
 
     public function typesProvider()
     {
-        return [
+        $provider = [
             ['id', [new Type(Type::BUILTIN_TYPE_INT)]],
             ['guid', [new Type(Type::BUILTIN_TYPE_STRING)]],
             ['bigint', [new Type(Type::BUILTIN_TYPE_STRING)]],
@@ -167,7 +180,7 @@ public function typesProvider()
             ['decimal', [new Type(Type::BUILTIN_TYPE_STRING)]],
             ['bool', [new Type(Type::BUILTIN_TYPE_BOOL)]],
             ['binary', [new Type(Type::BUILTIN_TYPE_RESOURCE)]],
-            ['json', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true)]],
+            ['jsonArray', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true)]],
             ['foo', [new Type(Type::BUILTIN_TYPE_OBJECT, true, 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation')]],
             ['bar', [new Type(
                 Type::BUILTIN_TYPE_OBJECT,
@@ -206,6 +219,12 @@ public function typesProvider()
             )]],
             ['indexedByCustomType', null],
         ];
+
+        if (class_exists(Types::class)) {
+            $provider[] = ['json', [new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)]];
+        }
+
+        return $provider;
     }
 
     public function testGetPropertiesCatchException()
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
index c8bd04e4ec5f4..81264fad27c5f 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
@@ -74,7 +74,7 @@ class DoctrineDummy
     /**
      * @Column(type="json_array")
      */
-    private $json;
+    private $jsonArray;
 
     /**
      * @Column(type="simple_array")

From 8e9eafe18bb445a66646e8aa12cc8d5fe3cdaed5 Mon Sep 17 00:00:00 2001
From: Mathias Arlaud 
Date: Mon, 24 Feb 2020 20:02:01 +0100
Subject: [PATCH 115/130] [Routing] Improve localized routes performances

---
 .../Component/Routing/RouteCompiler.php       |  8 ++++
 .../dumper/compiled_url_matcher14.php         | 19 ++++++++
 .../Dumper/CompiledUrlMatcherDumperTest.php   | 44 +++++++++++++------
 3 files changed, 57 insertions(+), 14 deletions(-)
 create mode 100644 src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher14.php

diff --git a/src/Symfony/Component/Routing/RouteCompiler.php b/src/Symfony/Component/Routing/RouteCompiler.php
index 59f3a327e0f6a..1f94a46cbd47f 100644
--- a/src/Symfony/Component/Routing/RouteCompiler.php
+++ b/src/Symfony/Component/Routing/RouteCompiler.php
@@ -61,6 +61,14 @@ public static function compile(Route $route)
             $hostRegex = $result['regex'];
         }
 
+        $locale = $route->getDefault('_locale');
+        if (null !== $locale && null !== $route->getDefault('_canonical_route') && preg_quote($locale, self::REGEX_DELIMITER) === $route->getRequirement('_locale')) {
+            $requirements = $route->getRequirements();
+            unset($requirements['_locale']);
+            $route->setRequirements($requirements);
+            $route->setPath(str_replace('{_locale}', $locale, $route->getPath()));
+        }
+
         $path = $route->getPath();
 
         $result = self::compilePattern($route, $path, false);
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher14.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher14.php
new file mode 100644
index 0000000000000..3645aff291846
--- /dev/null
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher14.php
@@ -0,0 +1,19 @@
+ [[['_route' => 'home', '_locale' => 'fr'], null, null, null, false, false, null]],
+        '/en/home' => [[['_route' => 'home', '_locale' => 'en'], null, null, null, false, false, null]],
+    ],
+    [ // $regexpList
+    ],
+    [ // $dynamicRoutes
+    ],
+    null, // $checkCondition
+];
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php
index 4581fa89f197f..f0c046e0b34ad 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php
@@ -12,6 +12,9 @@
 namespace Symfony\Component\Routing\Tests\Matcher\Dumper;
 
 use PHPUnit\Framework\TestCase;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
+use Symfony\Component\Routing\Loader\PhpFileLoader;
 use Symfony\Component\Routing\Matcher\CompiledUrlMatcher;
 use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper;
 use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
@@ -442,21 +445,34 @@ public function getRouteCollections()
         $hostCollection->add('r1', (new Route('abc{foo}'))->setHost('{foo}.exampple.com'));
         $hostCollection->add('r2', (new Route('abc{foo}'))->setHost('{foo}.exampple.com'));
 
+        /* test case 14 */
+        $fixedLocaleCollection = new RouteCollection();
+        $routes = new RoutingConfigurator($fixedLocaleCollection, new PhpFileLoader(new FileLocator()), __FILE__, __FILE__);
+        $routes
+            ->collection()
+            ->prefix('/{_locale}')
+            ->add('home', [
+                'fr' => 'accueil',
+                'en' => 'home',
+            ])
+        ;
+
         return [
-           [new RouteCollection(), 'compiled_url_matcher0.php'],
-           [$collection, 'compiled_url_matcher1.php'],
-           [$redirectCollection, 'compiled_url_matcher2.php'],
-           [$rootprefixCollection, 'compiled_url_matcher3.php'],
-           [$headMatchCasesCollection, 'compiled_url_matcher4.php'],
-           [$groupOptimisedCollection, 'compiled_url_matcher5.php'],
-           [$trailingSlashCollection, 'compiled_url_matcher6.php'],
-           [$trailingSlashCollection, 'compiled_url_matcher7.php'],
-           [$unicodeCollection, 'compiled_url_matcher8.php'],
-           [$hostTreeCollection, 'compiled_url_matcher9.php'],
-           [$chunkedCollection, 'compiled_url_matcher10.php'],
-           [$demoCollection, 'compiled_url_matcher11.php'],
-           [$suffixCollection, 'compiled_url_matcher12.php'],
-           [$hostCollection, 'compiled_url_matcher13.php'],
+            [new RouteCollection(), 'compiled_url_matcher0.php'],
+            [$collection, 'compiled_url_matcher1.php'],
+            [$redirectCollection, 'compiled_url_matcher2.php'],
+            [$rootprefixCollection, 'compiled_url_matcher3.php'],
+            [$headMatchCasesCollection, 'compiled_url_matcher4.php'],
+            [$groupOptimisedCollection, 'compiled_url_matcher5.php'],
+            [$trailingSlashCollection, 'compiled_url_matcher6.php'],
+            [$trailingSlashCollection, 'compiled_url_matcher7.php'],
+            [$unicodeCollection, 'compiled_url_matcher8.php'],
+            [$hostTreeCollection, 'compiled_url_matcher9.php'],
+            [$chunkedCollection, 'compiled_url_matcher10.php'],
+            [$demoCollection, 'compiled_url_matcher11.php'],
+            [$suffixCollection, 'compiled_url_matcher12.php'],
+            [$hostCollection, 'compiled_url_matcher13.php'],
+            [$fixedLocaleCollection, 'compiled_url_matcher14.php'],
         ];
     }
 

From 06539173e7f89b64c861a034610d4f55357fa248 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20TAMARELLE?= 
Date: Fri, 21 Feb 2020 23:42:54 +0100
Subject: [PATCH 116/130] [HttpClient][DX] Add URL context to JsonException
 messages

---
 .../HttpClient/Response/ResponseTrait.php     |  8 +--
 .../Tests/Response/MockResponseTest.php       | 68 +++++++++++++++++++
 2 files changed, 72 insertions(+), 4 deletions(-)
 create mode 100644 src/Symfony/Component/HttpClient/Tests/Response/MockResponseTest.php

diff --git a/src/Symfony/Component/HttpClient/Response/ResponseTrait.php b/src/Symfony/Component/HttpClient/Response/ResponseTrait.php
index 000da5344dcfe..595ac9737c072 100644
--- a/src/Symfony/Component/HttpClient/Response/ResponseTrait.php
+++ b/src/Symfony/Component/HttpClient/Response/ResponseTrait.php
@@ -147,21 +147,21 @@ public function toArray(bool $throw = true): array
         $contentType = $this->headers['content-type'][0] ?? 'application/json';
 
         if (!preg_match('/\bjson\b/i', $contentType)) {
-            throw new JsonException(sprintf('Response content-type is "%s" while a JSON-compatible one was expected.', $contentType));
+            throw new JsonException(sprintf('Response content-type is "%s" while a JSON-compatible one was expected for "%s".', $contentType, $this->getInfo('url')));
         }
 
         try {
             $content = json_decode($content, true, 512, JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0));
         } catch (\JsonException $e) {
-            throw new JsonException($e->getMessage(), $e->getCode());
+            throw new JsonException(sprintf('%s for "%s".', $e->getMessage(), $this->getInfo('url')), $e->getCode());
         }
 
         if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error()) {
-            throw new JsonException(json_last_error_msg(), json_last_error());
+            throw new JsonException(sprintf('%s for "%s".', json_last_error_msg(), $this->getInfo('url')), json_last_error());
         }
 
         if (!\is_array($content)) {
-            throw new JsonException(sprintf('JSON content was expected to decode to an array, %s returned.', \gettype($content)));
+            throw new JsonException(sprintf('JSON content was expected to decode to an array, %s returned for "%s".', \gettype($content), $this->getInfo('url')));
         }
 
         if (null !== $this->content) {
diff --git a/src/Symfony/Component/HttpClient/Tests/Response/MockResponseTest.php b/src/Symfony/Component/HttpClient/Tests/Response/MockResponseTest.php
new file mode 100644
index 0000000000000..61ceb913a93e0
--- /dev/null
+++ b/src/Symfony/Component/HttpClient/Tests/Response/MockResponseTest.php
@@ -0,0 +1,68 @@
+ 'orange', 'size' => 42];
+        $response = new MockResponse(json_encode($data));
+        $response = MockResponse::fromRequest('GET', 'https://example.com/file.json', [], $response);
+
+        $this->assertSame($data, $response->toArray());
+    }
+
+    /**
+     * @dataProvider toArrayErrors
+     */
+    public function testToArrayError($content, $responseHeaders, $message)
+    {
+        $this->expectException(JsonException::class);
+        $this->expectExceptionMessage($message);
+
+        $response = new MockResponse($content, ['response_headers' => $responseHeaders]);
+        $response = MockResponse::fromRequest('GET', 'https://example.com/file.json', [], $response);
+        $response->toArray();
+    }
+
+    public function toArrayErrors()
+    {
+        yield [
+            'content' => '{}',
+            'responseHeaders' => ['content-type' => 'plain/text'],
+            'message' => 'Response content-type is "plain/text" while a JSON-compatible one was expected for "https://example.com/file.json".',
+        ];
+
+        yield [
+            'content' => 'not json',
+            'responseHeaders' => [],
+            'message' => 'Syntax error for "https://example.com/file.json".',
+        ];
+
+        yield [
+            'content' => '[1,2}',
+            'responseHeaders' => [],
+            'message' => 'State mismatch (invalid or malformed JSON) for "https://example.com/file.json".',
+        ];
+
+        yield [
+            'content' => '"not an array"',
+            'responseHeaders' => [],
+            'message' => 'JSON content was expected to decode to an array, string returned for "https://example.com/file.json".',
+        ];
+
+        yield [
+            'content' => '8',
+            'responseHeaders' => [],
+            'message' => 'JSON content was expected to decode to an array, integer returned for "https://example.com/file.json".',
+        ];
+    }
+}

From b515bc9a97f0bb3daf5bb9b6113e3250cd95c094 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 25 Feb 2020 14:09:27 +0100
Subject: [PATCH 117/130] minor #35833 [FrameworkBundle] Add missing items in
 the unused tag pass whitelist (fabpot)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] Add missing items in the unused tag pass whitelist

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no 
| Deprecations? | no 
| Tickets       | n/a 
| License       | MIT
| Doc PR        | n/a

We have some missing tags in the whitelist. I've added a script that adds the missing ones, and added a test to avoid forgetting about updating the whitelist.

Commits
-------

d1bcc0fc5e [FrameworkBundle] Add a script that checks for missing items in the unused tag whitelist
---
 .../Compiler/UnusedTagsPass.php               | 13 +++-
 .../bin/check-unused-tags-whitelist.php       | 19 ++++++
 .../Compiler/UnusedTagsPassTest.php           | 23 +++++++
 .../Compiler/UnusedTagsPassUtils.php          | 68 +++++++++++++++++++
 4 files changed, 122 insertions(+), 1 deletion(-)
 create mode 100644 src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-tags-whitelist.php
 create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassUtils.php

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php
index 606fbd045355e..3cbe534fb99ed 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php
@@ -23,13 +23,17 @@ class UnusedTagsPass implements CompilerPassInterface
 {
     private $whitelist = [
         'annotations.cached_reader',
+        'auto_alias',
+        'cache.pool',
         'cache.pool.clearer',
+        'config_cache.resource_checker',
         'console.command',
+        'container.env_var_processor',
         'container.hot_path',
         'container.service_locator',
         'container.service_subscriber',
+        'controller.argument_value_resolver',
         'controller.service_arguments',
-        'config_cache.resource_checker',
         'data_collector',
         'form.type',
         'form.type_extension',
@@ -39,7 +43,12 @@ class UnusedTagsPass implements CompilerPassInterface
         'kernel.event_listener',
         'kernel.event_subscriber',
         'kernel.fragment_renderer',
+        'kernel.reset',
         'monolog.logger',
+        'property_info.access_extractor',
+        'property_info.list_extractor',
+        'property_info.type_extractor',
+        'proxy',
         'routing.expression_language_provider',
         'routing.loader',
         'security.expression_language_provider',
@@ -53,8 +62,10 @@ class UnusedTagsPass implements CompilerPassInterface
         'translation.loader',
         'twig.extension',
         'twig.loader',
+        'twig.runtime',
         'validator.constraint_validator',
         'validator.initializer',
+        'workflow.definition',
     ];
 
     public function process(ContainerBuilder $container)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-tags-whitelist.php b/src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-tags-whitelist.php
new file mode 100644
index 0000000000000..7f24973cd8f14
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-tags-whitelist.php
@@ -0,0 +1,19 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+require dirname(__DIR__, 6).'/vendor/autoload.php';
+
+use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\UnusedTagsPassUtils;
+
+$target = dirname(__DIR__, 2).'/DependencyInjection/Compiler/UnusedTagsPass.php';
+$contents = file_get_contents($target);
+$contents = preg_replace('{private \$whitelist = \[(.+?)\];}sm', "private \$whitelist = [\n        '".implode("',\n        '", UnusedTagsPassUtils::getDefinedTags())."',\n    ];", $contents);
+file_put_contents($target, $contents);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php
index 1377a62882494..58011375e74f3 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php
@@ -31,4 +31,27 @@ public function testProcess()
 
         $this->assertSame([sprintf('%s: Tag "kenrel.event_subscriber" was defined on service(s) "foo", "bar", but was never used. Did you mean "kernel.event_subscriber"?', UnusedTagsPass::class)], $container->getCompiler()->getLog());
     }
+
+    public function testMissingWhitelistTags()
+    {
+        if (\dirname((new \ReflectionClass(ContainerBuilder::class))->getFileName(), 3) !== \dirname(__DIR__, 5)) {
+            $this->markTestSkipped('Tests are not run from the root symfony/symfony metapackage.');
+        }
+
+        $this->assertSame(UnusedTagsPassUtils::getDefinedTags(), $this->getWhitelistTags(), 'The src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php file must be updated; run src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-tags-whitelist.php.');
+    }
+
+    private function getWhitelistTags()
+    {
+        // get tags in UnusedTagsPass
+        $target = \dirname(__DIR__, 3).'/DependencyInjection/Compiler/UnusedTagsPass.php';
+        $contents = file_get_contents($target);
+        preg_match('{private \$whitelist = \[(.+?)\];}sm', $contents, $matches);
+        $tags = array_values(array_filter(array_map(function ($str) {
+            return trim(preg_replace('{^ +\'(.+)\',}', '$1', $str));
+        }, explode("\n", $matches[1]))));
+        sort($tags);
+
+        return $tags;
+    }
 }
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassUtils.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassUtils.php
new file mode 100644
index 0000000000000..558c3e3c0749d
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassUtils.php
@@ -0,0 +1,68 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
+
+use Symfony\Component\Finder\Finder;
+
+class UnusedTagsPassUtils
+{
+    public static function getDefinedTags()
+    {
+        $tags = [
+            'proxy' => true,
+        ];
+
+        // get all tags used in XML configs
+        $files = Finder::create()->files()->name('*.xml')->path('Resources')->notPath('Tests')->in(\dirname(__DIR__, 5));
+        foreach ($files as $file) {
+            $contents = file_get_contents($file);
+            if (preg_match_all('{files()->name('*.php')->path('DependencyInjection')->notPath('Tests')->in(\dirname(__DIR__, 5));
+        foreach ($files as $file) {
+            $contents = file_get_contents($file);
+            if (preg_match_all('{findTaggedServiceIds\(\'([^\']+)\'}', $contents, $matches)) {
+                foreach ($matches[1] as $match) {
+                    if ('my.tag' === $match) {
+                        continue;
+                    }
+                    $tags[$match] = true;
+                }
+            }
+            if (preg_match_all('{findTaggedServiceIds\(\$this->([^,\)]+)}', $contents, $matches)) {
+                foreach ($matches[1] as $var) {
+                    if (preg_match_all('{\$'.$var.' = \'([^\']+)\'}', $contents, $matches)) {
+                        foreach ($matches[1] as $match) {
+                            $tags[$match] = true;
+                        }
+                    }
+                }
+            }
+        }
+
+        $tags = array_keys($tags);
+        sort($tags);
+
+        return $tags;
+    }
+}

From 159ef1bf1d381bd57391e6079d40b9b479a79b6e Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 25 Feb 2020 15:31:47 +0100
Subject: [PATCH 118/130] [FrameworkBundle] Fix test

---
 .../Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php  | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php
index 58011375e74f3..a73cdd167133d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php
@@ -15,6 +15,9 @@
 use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\UnusedTagsPass;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 
+/**
+ * @requires PHP 7.0
+ */
 class UnusedTagsPassTest extends TestCase
 {
     public function testProcess()

From 03530770832552007fde72500b5c96940856307b Mon Sep 17 00:00:00 2001
From: Robin Chalas 
Date: Sun, 23 Feb 2020 15:53:58 +0100
Subject: [PATCH 119/130] [Security] Allow switching to another user when
 already switched

---
 .../Tests/Functional/SwitchUserTest.php       |  6 ++--
 .../Bundle/SecurityBundle/composer.json       |  2 +-
 .../Http/Firewall/SwitchUserListener.php      |  5 ++--
 .../Tests/Firewall/SwitchUserListenerTest.php | 30 +++++++++++++++++++
 4 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php
index 722bef0f78628..e740ac4666b2b 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php
@@ -33,15 +33,15 @@ public function testSwitchUser($originalUser, $targetUser, $expectedUser, $expec
         $this->assertEquals($expectedUser, $client->getProfile()->getCollector('security')->getUser());
     }
 
-    public function testSwitchedUserCannotSwitchToOther()
+    public function testSwitchedUserCanSwitchToOther()
     {
         $client = $this->createAuthenticatedClient('user_can_switch');
 
         $client->request('GET', '/profile?_switch_user=user_cannot_switch_1');
         $client->request('GET', '/profile?_switch_user=user_cannot_switch_2');
 
-        $this->assertEquals(500, $client->getResponse()->getStatusCode());
-        $this->assertEquals('user_cannot_switch_1', $client->getProfile()->getCollector('security')->getUser());
+        $this->assertEquals(200, $client->getResponse()->getStatusCode());
+        $this->assertEquals('user_cannot_switch_2', $client->getProfile()->getCollector('security')->getUser());
     }
 
     public function testSwitchedUserExit()
diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json
index f0e35c7f3d7e8..84b624ec7b5fe 100644
--- a/src/Symfony/Bundle/SecurityBundle/composer.json
+++ b/src/Symfony/Bundle/SecurityBundle/composer.json
@@ -19,7 +19,7 @@
         "php": "^5.5.9|>=7.0.8",
         "ext-xml": "*",
         "symfony/config": "~3.4|~4.0",
-        "symfony/security": "~3.4.37|~4.3.10|^4.4.3",
+        "symfony/security": "~3.4.38|~4.3.10|^4.4.5",
         "symfony/dependency-injection": "^3.4.3|^4.0.3",
         "symfony/http-kernel": "~3.4|~4.0",
         "symfony/polyfill-php70": "~1.0"
diff --git a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
index 70492cc79d84e..a5d077fb310d8 100644
--- a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
+++ b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
@@ -134,7 +134,8 @@ private function attemptSwitchUser(Request $request, $username)
                 return $token;
             }
 
-            throw new \LogicException(sprintf('You are already switched to "%s" user.', $token->getUsername()));
+            // User already switched, exit before seamlessly switching to another user
+            $token = $this->attemptExitUser($request);
         }
 
         if (false === $this->accessDecisionManager->decide($token, [$this->role])) {
@@ -152,7 +153,7 @@ private function attemptSwitchUser(Request $request, $username)
         $this->userChecker->checkPostAuth($user);
 
         $roles = $user->getRoles();
-        $roles[] = new SwitchUserRole('ROLE_PREVIOUS_ADMIN', $this->tokenStorage->getToken());
+        $roles[] = new SwitchUserRole('ROLE_PREVIOUS_ADMIN', $token);
 
         $token = new UsernamePasswordToken($user, $user->getPassword(), $this->providerKey, $roles);
 
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
index f4060f46b7790..ab77180e53c57 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
@@ -191,6 +191,36 @@ public function testSwitchUser()
         $this->assertInstanceOf('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken', $this->tokenStorage->getToken());
     }
 
+    public function testSwitchUserAlreadySwitched()
+    {
+        $originalToken = new UsernamePasswordToken('original', null, 'key', ['ROLE_FOO']);
+        $alreadySwitchedToken = new UsernamePasswordToken('switched_1', null, 'key', [new SwitchUserRole('ROLE_PREVIOUS_ADMIN', $originalToken)]);
+
+        $tokenStorage = new TokenStorage();
+        $tokenStorage->setToken($alreadySwitchedToken);
+
+        $targetUser = new User('kuba', 'password', ['ROLE_FOO', 'ROLE_BAR']);
+        $this->request->query->set('_switch_user', 'kuba');
+
+        $this->accessDecisionManager->expects($this->once())
+            ->method('decide')->with($originalToken, ['ROLE_ALLOWED_TO_SWITCH'])
+            ->willReturn(true);
+        $this->userProvider->expects($this->once())
+            ->method('loadUserByUsername')
+            ->with('kuba')
+            ->willReturn($targetUser);
+        $this->userChecker->expects($this->once())
+            ->method('checkPostAuth')->with($targetUser);
+
+        $listener = new SwitchUserListener($tokenStorage, $this->userProvider, $this->userChecker, 'provider123', $this->accessDecisionManager, null, '_switch_user', 'ROLE_ALLOWED_TO_SWITCH', null, false);
+        $listener->handle($this->event);
+
+        $this->assertSame([], $this->request->query->all());
+        $this->assertSame('', $this->request->server->get('QUERY_STRING'));
+        $this->assertSame('kuba', $tokenStorage->getToken()->getUsername());
+        $this->assertSame($originalToken, $tokenStorage->getToken()->getRoles()[2]->getSource());
+    }
+
     public function testSwitchUserWorksWithFalsyUsernames()
     {
         $token = new UsernamePasswordToken('username', '', 'key', ['ROLE_FOO']);

From 55734a297fd74e5966b96ab3a8041fb101a61fa5 Mon Sep 17 00:00:00 2001
From: Alessandro Chitolina 
Date: Sun, 23 Feb 2020 21:16:04 +0100
Subject: [PATCH 120/130] [ErrorHandler] fix parsing static return type on
 interface method annotation (fix #35836)

---
 .../Component/ErrorHandler/DebugClassLoader.php        | 10 +++++-----
 .../ErrorHandler/Tests/DebugClassLoaderTest.php        |  1 +
 .../ErrorHandler/Tests/Fixtures/VirtualInterface.php   |  3 ++-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
index 9e410ccc3d636..71f21f50fadf0 100644
--- a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
+++ b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
@@ -428,17 +428,17 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
                 }
             }
 
-            if ($refl->isInterface() && false !== strpos($doc, 'method') && preg_match_all('#\n \* @method\s+(static\s+)?+(?:[\w\|&\[\]\\\]+\s+)?(\w+(?:\s*\([^\)]*\))?)+(.+?([[:punct:]]\s*)?)?(?=\r?\n \*(?: @|/$|\r?\n))#', $doc, $notice, PREG_SET_ORDER)) {
+            if ($refl->isInterface() && false !== strpos($doc, 'method') && preg_match_all('#\n \* @method\s+(static\s+)?+([\w\|&\[\]\\\]+\s+)?(\w+(?:\s*\([^\)]*\))?)+(.+?([[:punct:]]\s*)?)?(?=\r?\n \*(?: @|/$|\r?\n))#', $doc, $notice, PREG_SET_ORDER)) {
                 foreach ($notice as $method) {
-                    $static = '' !== $method[1];
-                    $name = $method[2];
-                    $description = $method[3] ?? null;
+                    $static = '' !== $method[1] && !empty($method[2]);
+                    $name = $method[3];
+                    $description = $method[4] ?? null;
                     if (false === strpos($name, '(')) {
                         $name .= '()';
                     }
                     if (null !== $description) {
                         $description = trim($description);
-                        if (!isset($method[4])) {
+                        if (!isset($method[5])) {
                             $description .= '.';
                         }
                     }
diff --git a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php
index adf55432ee395..d0ff0afba8710 100644
--- a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php
+++ b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php
@@ -325,6 +325,7 @@ class_exists('Test\\'.ExtendsVirtual::class, true);
         restore_error_handler();
 
         $this->assertSame([
+            'Class "Test\Symfony\Component\ErrorHandler\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\ErrorHandler\Tests\Fixtures\VirtualInterface::staticReturningMethod()".',
             'Class "Test\Symfony\Component\ErrorHandler\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\ErrorHandler\Tests\Fixtures\VirtualInterface::sameLineInterfaceMethodNoBraces()".',
             'Class "Test\Symfony\Component\ErrorHandler\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\ErrorHandler\Tests\Fixtures\VirtualInterface::newLineInterfaceMethod()": Some description!',
             'Class "Test\Symfony\Component\ErrorHandler\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\ErrorHandler\Tests\Fixtures\VirtualInterface::newLineInterfaceMethodNoBraces()": Description.',
diff --git a/src/Symfony/Component/ErrorHandler/Tests/Fixtures/VirtualInterface.php b/src/Symfony/Component/ErrorHandler/Tests/Fixtures/VirtualInterface.php
index fd1c8ba04edf8..5c9136081fe70 100644
--- a/src/Symfony/Component/ErrorHandler/Tests/Fixtures/VirtualInterface.php
+++ b/src/Symfony/Component/ErrorHandler/Tests/Fixtures/VirtualInterface.php
@@ -4,6 +4,7 @@
 
 /**
  * @method string interfaceMethod()
+ * @method static staticReturningMethod()
  * @method        sameLineInterfaceMethod($arg)
  * @method sameLineInterfaceMethodNoBraces
  *
@@ -25,7 +26,7 @@
  *
  * Static
  * @method static Foo&Bar staticMethod()
- * @method static staticMethodNoBraces
+ * @method static mixed staticMethodNoBraces
  * @method static \stdClass staticMethodTyped(int $arg) Description
  * @method static \stdClass[] staticMethodTypedNoBraces
  */

From f8735cc47b1fd13a98817d7c06ab0dd64a5af788 Mon Sep 17 00:00:00 2001
From: Thomas Calvet 
Date: Tue, 25 Feb 2020 17:47:03 +0100
Subject: [PATCH 121/130] [DomCrawler][Form] Fix PHPDoc on get & offsetGet

---
 src/Symfony/Component/DomCrawler/Form.php     |  4 +--
 .../DomCrawler/FormFieldRegistry.php          |  2 +-
 .../Component/DomCrawler/Tests/FormTest.php   | 33 ++++++++++++++++++-
 3 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/Symfony/Component/DomCrawler/Form.php b/src/Symfony/Component/DomCrawler/Form.php
index 375ee531c4a0e..0a86c7e6d4069 100644
--- a/src/Symfony/Component/DomCrawler/Form.php
+++ b/src/Symfony/Component/DomCrawler/Form.php
@@ -269,7 +269,7 @@ public function remove($name)
      *
      * @param string $name The field name
      *
-     * @return FormField The field instance
+     * @return FormField|FormField[]|FormField[][] The value of the field
      *
      * @throws \InvalidArgumentException When field is not present in this form
      */
@@ -313,7 +313,7 @@ public function offsetExists($name)
      *
      * @param string $name The field name
      *
-     * @return FormField The associated Field instance
+     * @return FormField|FormField[]|FormField[][] The value of the field
      *
      * @throws \InvalidArgumentException if the field does not exist
      */
diff --git a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php
index 901a5c8dec1cd..3bbcfa74734ef 100644
--- a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php
+++ b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php
@@ -70,7 +70,7 @@ public function remove($name)
      *
      * @param string $name The fully qualified name of the field
      *
-     * @return mixed The value of the field
+     * @return FormField|FormField[]|FormField[][] The value of the field
      *
      * @throws \InvalidArgumentException if the field does not exist
      */
diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
index 1867f30a651a3..9894eb429a9ee 100644
--- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
@@ -12,6 +12,7 @@
 namespace Symfony\Component\DomCrawler\Tests;
 
 use PHPUnit\Framework\TestCase;
+use Symfony\Component\DomCrawler\Field\TextareaFormField;
 use Symfony\Component\DomCrawler\Form;
 use Symfony\Component\DomCrawler\FormFieldRegistry;
 
@@ -953,7 +954,7 @@ protected function createTestMultipleForm()
         return $dom;
     }
 
-    public function testgetPhpValuesWithEmptyTextarea()
+    public function testGetPhpValuesWithEmptyTextarea()
     {
         $dom = new \DOMDocument();
         $dom->loadHTML('
@@ -968,4 +969,34 @@ public function testgetPhpValuesWithEmptyTextarea()
         $form = new Form($nodes->item(0), 'http://example.com');
         $this->assertEquals($form->getPhpValues(), ['example' => '']);
     }
+
+    public function testGetReturnTypes()
+    {
+        $dom = new \DOMDocument();
+        $dom->loadHTML('
+            
+                
+ + + ' + ); + + $nodes = $dom->getElementsByTagName('form'); + $form = new Form($nodes->item(0), 'http://example.com'); + + // FormField + $this->assertInstanceOf(TextareaFormField::class, $textareaFormField = $form->get('foo[collection][0][bar]')); + + // Array of FormField + $this->assertSame([ + 'bar' => $textareaFormField, + ], $form->get('foo[collection][0]')); + + // Array of array of FormField + $this->assertSame([ + [ + 'bar' => $textareaFormField, + ], + ], $form->get('foo[collection]')); + } } From 491fc5c24d785937c82f5fc8349edbe5155da01f Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Wed, 26 Feb 2020 21:34:36 +0100 Subject: [PATCH 122/130] [Validator][ConstraintValidator] Update wrong PRETTY_DATE doc --- src/Symfony/Component/Validator/ConstraintValidator.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Validator/ConstraintValidator.php b/src/Symfony/Component/Validator/ConstraintValidator.php index 458351fe2ee00..db0ccb60a8cbc 100644 --- a/src/Symfony/Component/Validator/ConstraintValidator.php +++ b/src/Symfony/Component/Validator/ConstraintValidator.php @@ -21,8 +21,8 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface { /** - * Whether to format {@link \DateTime} objects as RFC-3339 dates - * ("Y-m-d H:i:s"). + * Whether to format {@link \DateTime} objects, either with the {@link \IntlDateFormatter} + * (if it is available) or as RFC-3339 dates ("Y-m-d H:i:s"). */ const PRETTY_DATE = 1; @@ -69,7 +69,8 @@ protected function formatTypeOf($value) * in double quotes ("). Objects, arrays and resources are formatted as * "object", "array" and "resource". If the $format bitmask contains * the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted - * as RFC-3339 dates ("Y-m-d H:i:s"). + * with the {@link \IntlDateFormatter}. If it is not available, they will be + * formatted as RFC-3339 dates ("Y-m-d H:i:s"). * * Be careful when passing message parameters to a constraint violation * that (may) contain objects, arrays or resources. These parameters From 1f953e42f2adb1e3d0873a16b799891f6c47031f Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Wed, 26 Feb 2020 23:30:10 +0100 Subject: [PATCH 123/130] [5.0] Remove some unused variables --- src/Symfony/Component/HttpClient/Internal/HttplugWaitLoop.php | 2 +- src/Symfony/Component/String/UnicodeString.php | 2 +- src/Symfony/Component/VarDumper/Cloner/VarCloner.php | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpClient/Internal/HttplugWaitLoop.php b/src/Symfony/Component/HttpClient/Internal/HttplugWaitLoop.php index 3f287feb6b80d..f17a4a78503c3 100644 --- a/src/Symfony/Component/HttpClient/Internal/HttplugWaitLoop.php +++ b/src/Symfony/Component/HttpClient/Internal/HttplugWaitLoop.php @@ -72,7 +72,7 @@ public function wait(?ResponseInterface $pendingResponse, float $maxDuration = n goto check_duration; } - if ([$request, $promise] = $this->promisePool[$response] ?? null) { + if ([, $promise] = $this->promisePool[$response] ?? null) { unset($this->promisePool[$response]); $promise->resolve($this->createPsr7Response($response, true)); } diff --git a/src/Symfony/Component/String/UnicodeString.php b/src/Symfony/Component/String/UnicodeString.php index ada77caaae4c0..0d057a445b0f2 100644 --- a/src/Symfony/Component/String/UnicodeString.php +++ b/src/Symfony/Component/String/UnicodeString.php @@ -243,7 +243,7 @@ public function replace(string $from, string $to): AbstractString $tail = substr($tail, \strlen($slice) + \strlen($from)); } - $str->string = $result .= $tail; + $str->string = $result.$tail; normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); if (false === $str->string) { diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index 4c653d627df3b..f02a59d5670c0 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -28,7 +28,6 @@ protected function doClone($var) $pos = 0; // Number of cloned items past the minimum depth $refsCounter = 0; // Hard references counter $queue = [[$var]]; // This breadth-first queue is the return value - $indexedArrays = []; // Map of queue indexes that hold numerically indexed arrays $hardRefs = []; // Map of original zval ids to stub objects $objRefs = []; // Map of original object handles to their stub object counterpart $objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning From 45a033d67b22075d29eb3969bb8329dc165a704d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 28 Feb 2020 13:03:21 +0100 Subject: [PATCH 124/130] add missing Messenger options to XML schema definition --- .../Resources/config/schema/symfony-1.0.xsd | 10 ++++++++++ .../Fixtures/php/messenger_transports.php | 8 ++++++++ .../Fixtures/xml/messenger_transports.xml | 4 +++- .../Fixtures/yml/messenger_transports.yml | 7 +++++++ .../DependencyInjection/FrameworkExtensionTest.php | 7 +++++++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 0c4f6b85fc1c0..403119842e28e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -427,6 +427,7 @@ + @@ -457,12 +458,21 @@ + + + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger_transports.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger_transports.php index 68ff3607465b2..0aff440e855e9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger_transports.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger_transports.php @@ -3,6 +3,7 @@ $container->loadFromExtension('framework', [ 'serializer' => true, 'messenger' => [ + 'failure_transport' => 'failed', 'serializer' => [ 'default_serializer' => 'messenger.transport.symfony_serializer', ], @@ -12,7 +13,14 @@ 'dsn' => 'amqp://localhost/%2f/messages?exchange_name=exchange_name', 'options' => ['queue' => ['name' => 'Queue']], 'serializer' => 'messenger.transport.native_php_serializer', + 'retry_strategy' => [ + 'max_retries' => 10, + 'delay' => 7, + 'multiplier' => 3, + 'max_delay' => 100, + ], ], + 'failed' => 'in-memory:///', 'redis' => 'redis://127.0.0.1:6379/messages', ], ], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger_transports.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger_transports.xml index bb698cbc17105..837db14c1cad4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger_transports.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger_transports.xml @@ -7,7 +7,7 @@ - + @@ -16,7 +16,9 @@ Queue + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger_transports.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger_transports.yml index 2fc1f482653e4..daab75bd87e40 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger_transports.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger_transports.yml @@ -1,6 +1,7 @@ framework: serializer: true messenger: + failure_transport: failed serializer: default_serializer: messenger.transport.symfony_serializer transports: @@ -11,4 +12,10 @@ framework: queue: name: Queue serializer: 'messenger.transport.native_php_serializer' + retry_strategy: + max_retries: 10 + delay: 7 + multiplier: 3 + max_delay: 100 + failed: 'in-memory:///' redis: 'redis://127.0.0.1:6379/messages' diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index b65ab9e011f28..edcdb7aae487f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -725,6 +725,13 @@ public function testMessengerTransports() $this->assertSame('redis://127.0.0.1:6379/messages', $transportArguments[0]); $this->assertTrue($container->hasDefinition('messenger.transport.redis.factory')); + + $this->assertSame(10, $container->getDefinition('messenger.retry.multiplier_retry_strategy.customised')->getArgument(0)); + $this->assertSame(7, $container->getDefinition('messenger.retry.multiplier_retry_strategy.customised')->getArgument(1)); + $this->assertSame(3, $container->getDefinition('messenger.retry.multiplier_retry_strategy.customised')->getArgument(2)); + $this->assertSame(100, $container->getDefinition('messenger.retry.multiplier_retry_strategy.customised')->getArgument(3)); + + $this->assertEquals(new Reference('messenger.transport.failed'), $container->getDefinition('messenger.failure.send_failed_message_to_failure_transport_listener')->getArgument(0)); } public function testMessengerRouting() From 9d837ecb345a29386e3bdaee40fcf84ce8ec72ef Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 28 Feb 2020 15:30:03 +0100 Subject: [PATCH 125/130] add German translation --- .../Validator/Resources/translations/validators.de.xlf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf index 0702e8dfcdb1e..a546b86c78a9b 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf @@ -370,6 +370,10 @@ This value is not a valid hostname. Dieser Wert ist kein gültiger Hostname. + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Die Anzahl an Elementen in dieser Sammlung sollte ein Vielfaches von {{ compared_value }} sein. + From c16d1535226aa7e8162e7065adf7f55b242d2744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Sch=C3=A4dlich?= Date: Sat, 29 Feb 2020 09:54:47 +0100 Subject: [PATCH 126/130] [Validator] Add missing vietnamese translations --- .../Resources/translations/validators.vi.xlf | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf index 95dd7d6665997..ead79d2cd7e5b 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf @@ -362,6 +362,18 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Mật khẩu này đã bị rò rỉ dữ liệu, không được sử dụng nữa. Xin vui lòng sử dụng mật khẩu khác. + + This value should be between {{ min }} and {{ max }}. + Giá trị này nên thuộc giữa {{ min }} và {{ max }}. + + + This value is not a valid hostname. + Giá trị này không phải là tên máy chủ hợp lệ. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Số lượng các phần tử trong bộ sưu tập này nên là bội số của {{compared_value}}. + From 1c70048e9cb01a53d96f958e8246fcecdff22b64 Mon Sep 17 00:00:00 2001 From: Lynn Date: Mon, 17 Feb 2020 15:42:01 +0100 Subject: [PATCH 127/130] [DI] Clarified deprecation for TypedReference in 4.4 --- src/Symfony/Component/DependencyInjection/TypedReference.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/TypedReference.php b/src/Symfony/Component/DependencyInjection/TypedReference.php index 56a878874e2df..15b2b706c169c 100644 --- a/src/Symfony/Component/DependencyInjection/TypedReference.php +++ b/src/Symfony/Component/DependencyInjection/TypedReference.php @@ -31,7 +31,7 @@ class TypedReference extends Reference public function __construct(string $id, string $type, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $name = null) { if (\is_string($invalidBehavior ?? '') || \is_int($name)) { - @trigger_error(sprintf('The $requiringClass argument of "%s()" is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing the $requiringClass as 3rd argument for "%s()" is deprecated since Symfony 4.1. It should be removed, moving all following arguments 1 to the left.', __METHOD__), E_USER_DEPRECATED); $this->requiringClass = $invalidBehavior; $invalidBehavior = 3 < \func_num_args() ? func_get_arg(3) : ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; From 4f61247ccc847372eb27ec91fbdcacd826af0ddf Mon Sep 17 00:00:00 2001 From: jonmldr Date: Thu, 27 Feb 2020 15:24:32 +0100 Subject: [PATCH 128/130] [Dotenv] Documentation improvement --- src/Symfony/Component/Dotenv/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Dotenv/README.md b/src/Symfony/Component/Dotenv/README.md index c21223b04e42e..10bfff14ba78d 100644 --- a/src/Symfony/Component/Dotenv/README.md +++ b/src/Symfony/Component/Dotenv/README.md @@ -2,7 +2,7 @@ Dotenv Component ================ Symfony Dotenv parses `.env` files to make environment variables stored in them -accessible via `$_SERVER`, `$_ENV` and optionally `getenv()`. +accessible via `$_SERVER` or `$_ENV`. Resources --------- From 6ea479767f9079154807f8e629cde74ff83df916 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 29 Feb 2020 11:41:24 +0100 Subject: [PATCH 129/130] updated CHANGELOG for 5.0.5 --- CHANGELOG-5.0.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index afdb63bf51491..f743e9945c8c3 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -7,6 +7,70 @@ in 5.0 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v5.0.0...v5.0.1 +* 5.0.5 (2020-02-29) + + * bug #35781 [Form] NumberToLocalizedStringTransformer return int if scale = 0 (VincentLanglet) + * bug #35846 [Serializer] prevent method calls on null values (xabbuh) + * bug #35897 [FrameworkBundle] add missing Messenger options to XML schema definition (xabbuh) + * bug #35870 [ErrorHandler] fix parsing static return type on interface method annotation (alekitto) + * bug #35839 [Security] Allow switching to another user when already switched (chalasr) + * bug #35851 [DoctrineBridge] Use new Types::* constants and support new json types (fancyweb) + * bug #35841 [Notifier] Dispatch message event in null transport (jschaedl) + * bug #35716 [PhpUnitBridge] Fix compatibility to PHPUnit 9 (Benjamin) + * bug #35803 [Cache] Fix versioned namespace atomic clears (trvrnrth) + * bug #35817 [DoctrineBridge] Use new Types::* constants and support new json type (fancyweb) + * bug #35832 [Debug][ErrorHandler] improved deprecation notices for methods new args and return type (HeahDude) + * bug #35827 [BrowserKit] Nested file array prevents uploading file (afilina) + * bug #35826 [Notifier] Add correct tags for NullTransportFactory (jschaedl) + * bug #35830 [FrameworkBundle] Skip notifiers tags in UnusedTagsPass (chalasr) + * bug #35707 [ExpressionLanguage] Fixed collisions of character operators with object properties (Andrej-in-ua) + * bug #35794 [DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types (fancyweb) + * bug #35787 [PhpUnitBridge] Use trait instead of extending deprecated class (marcello-moenkemeyer) + * bug #35792 [Security] Prevent TypeError in case RememberMetoken has no attached user (nikophil) + * bug #35735 [Routing] Add locale requirement for localized routes (mtarld) + * bug #35772 [Config] don't throw on missing excluded paths (nicolas-grekas) + * bug #35774 [Ldap] force default network timeout (nicolas-grekas) + * bug #35702 [VarDumper] fixed DateCaster not displaying additional fields (Makdessi Alex) + * bug #35722 [HttpKernel] Set previous exception when rethrown from controller resolver (danut007ro) + * bug #35714 [HttpClient] Correctly remove trace level options for HttpCache (aschempp) + * bug #35718 [HttpKernel] fix registering DebugHandlersListener regardless of the PHP_SAPI (nicolas-grekas) + * bug #35728 Add missing autoload calls (greg0ire) + * bug #35693 [Finder] Fix unix root dir issue (chr-hertel) + * bug #35709 [HttpFoundation] fix not sending Content-Type header for 204 responses (Tobion) + * bug #35710 [ErrorHandler] silence warning when zend.assertions=-1 (nicolas-grekas) + * bug #35676 [Console] Handle zero row count in appendRow() for Table (Adam Prickett) + * bug #35696 [Console] Don't load same-namespace alternatives on exact match (chalasr) + * bug #35674 [HttpClient] fix getting response content after its destructor throwed an HttpExceptionInterface (nicolas-grekas) + * bug #35672 [HttpClient] fix HttpClientDataCollector when handling canceled responses (thematchless) + * bug #35641 [Process] throw when PhpProcess::fromShellCommandLine() is used (Guikingone) + * bug #35645 [ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable() (nicolas-grekas) + * bug #35633 [Mailer] Do not ping the SMTP server before sending every message (micheh) + * bug #33897 [Console] Consider STDIN interactive (ostrolucky) + * bug #35605 [HttpFoundation][FrameworkBundle] fix support for samesite in session cookies (fabpot) + * bug #35609 [DoctrineBridge] Fixed submitting ids with query limit or offset (HeahDude) + * bug #35616 [Workflow] Make method signature compatible with 4.4 (pbowyer) + * bug #35597 [PHPunit bridge] Provide current file as file path (greg0ire) + * bug #33960 [DI] Unknown env prefix not recognized as such (ro0NL) + * bug #35342 [DI] Fix support for multiple tags for locators and iterators (Alexandre Parent) + * bug #33820 [PhpUnitBridge] Fix some errors when using serialized deprecations (l-vo) + * bug #35553 Fix HTTP client config handling (julienfalque) + * bug #35588 [ErrorHandler] Escape variable in Exception template (jderusse) + * bug #35583 Add missing use statements (fabpot) + * bug #35582 Missing use statement 4.4 (fabpot) + * bug #34123 [Form] Fix handling of empty_data's \Closure value in Date/Time form types (yceruto) + * bug #35537 [Config][XmlReferenceDumper] Prevent potential \TypeError (fancyweb) + * bug #35227 [Mailer] Fix broken mandrill http send for recipients with names (vilius-g) + * bug #35430 [Translation] prefer intl domain when adding messages to catalogue (Guite) + * bug #35497 Fail on empty password verification (without warning on any implementation) (Stefan Kruppa) + * bug #35546 [Validator] check for __get method existence if property is uninitialized (alekitto) + * bug #35332 [Yaml][Inline] Fail properly on empty object tag and empty const tag (fancyweb) + * bug #35489 [PhpUnitBridge] Fix running skipped tests expecting only deprecations (chalasr) + * bug #35161 [FrameworkBundle] Check non-null type for numeric type (Arman-Hosseini) + * bug #34059 [DomCrawler] Skip disabled fields processing in Form (sbogx) + * bug #34114 [Console] SymonfyStyle - Check value isset to avoid PHP notice (leevigraham) + * bug #35557 [Config] dont catch instances of Error (nicolas-grekas) + * bug #35562 [HttpClient] fix HttpClientDataCollector when handling canceled responses (nicolas-grekas) + * 5.0.4 (2020-01-31) * bug #35530 [HttpClient] Fix regex bearer (noniagriconomie) From 9e1fab60f5601a9dc440c9dc0fa8dd618fb3939b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 29 Feb 2020 11:41:30 +0100 Subject: [PATCH 130/130] updated VERSION for 5.0.5 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 70e5f4552543f..ce30c8feba2e0 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -68,12 +68,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '5.0.5-DEV'; + const VERSION = '5.0.5'; const VERSION_ID = 50005; const MAJOR_VERSION = 5; const MINOR_VERSION = 0; const RELEASE_VERSION = 5; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '07/2020'; const END_OF_LIFE = '07/2020';
{{ collector.symfonyeom }} {{ collector.symfonyeol }} - View roadmap + View roadmap