From 126105146f91315c4e5d11169b2e8fbb055e3bc8 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 4 Jan 2021 11:12:41 +0100 Subject: [PATCH 01/10] apply the sort callback on the whole search result --- src/Symfony/Component/Finder/Finder.php | 17 ++++++---- .../Component/Finder/Tests/FinderTest.php | 33 +++++++++++++++++++ .../Tests/Iterator/IteratorTestCase.php | 3 +- 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index 011f661aab..4cf723bf33 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -624,7 +624,13 @@ class Finder implements \IteratorAggregate, \Countable } if (1 === \count($this->dirs) && 0 === \count($this->iterators)) { - return $this->searchInDirectory($this->dirs[0]); + $iterator = $this->searchInDirectory($this->dirs[0]); + + if ($this->sort || $this->reverseSorting) { + $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator(); + } + + return $iterator; } $iterator = new \AppendIterator(); @@ -636,6 +642,10 @@ class Finder implements \IteratorAggregate, \Countable $iterator->append($it); } + if ($this->sort || $this->reverseSorting) { + $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator(); + } + return $iterator; } @@ -782,11 +792,6 @@ class Finder implements \IteratorAggregate, \Countable $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $notPaths); } - if ($this->sort || $this->reverseSorting) { - $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting); - $iterator = $iteratorAggregate->getIterator(); - } - return $iterator; } diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index 9a12e85e25..efdb4c7447 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -832,6 +832,39 @@ class FinderTest extends Iterator\RealIteratorTestCase ]), $finder->in(self::$tmpDir)->getIterator()); } + public function testSortAcrossDirectories() + { + $finder = $this->buildFinder() + ->in([ + self::$tmpDir, + self::$tmpDir.'/qux', + self::$tmpDir.'/foo', + ]) + ->depth(0) + ->files() + ->filter(static function (\SplFileInfo $file): bool { + return '' !== $file->getExtension(); + }) + ->sort(static function (\SplFileInfo $a, \SplFileInfo $b): int { + return strcmp($a->getExtension(), $b->getExtension()) ?: strcmp($a->getFilename(), $b->getFilename()); + }) + ; + + $this->assertOrderedIterator($this->toAbsolute([ + 'qux_0_1.php', + 'qux_1000_1.php', + 'qux_1002_0.php', + 'qux_10_2.php', + 'qux_12_0.php', + 'qux_2_0.php', + 'test.php', + 'qux/baz_100_1.py', + 'qux/baz_1_2.py', + 'test.py', + 'foo/bar.tmp', + ]), $finder->getIterator()); + } + public function testFilter() { $finder = $this->buildFinder(); diff --git a/src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php b/src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php index c7dfd79e30..9bfc479de5 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php @@ -31,7 +31,8 @@ abstract class IteratorTestCase extends TestCase protected function assertOrderedIterator($expected, \Traversable $iterator) { - $values = array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator)); + $values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', \DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator)); + $expected = array_map(function ($path) { return str_replace('/', \DIRECTORY_SEPARATOR, $path); }, $expected); $this->assertEquals($expected, array_values($values)); } From acbafe889d69b427b3f16bb435c3abbc1f46474c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 4 Jan 2021 20:26:31 +0100 Subject: [PATCH 02/10] do not break when loading schemas from network paths on Windows --- .../Component/DependencyInjection/Loader/XmlFileLoader.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 98ac9345e8..13d02ebb7c 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -614,6 +614,8 @@ class XmlFileLoader extends FileLoader array_shift($parts); $locationstart = 'phar:///'; } + } elseif ('\\' === \DIRECTORY_SEPARATOR && 0 === strpos($location, '\\\\')) { + $locationstart = ''; } $drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; $location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts)); From 9e6baee9f36e314e3998a6d4346b5eedb6c7897e Mon Sep 17 00:00:00 2001 From: Andrea Ruggiero Date: Mon, 4 Jan 2021 21:57:14 +0100 Subject: [PATCH 03/10] Remove full head content in HTML to text converter When extracting text from HTML part all the content between opening and closing tag should be removed --- src/Symfony/Bridge/Twig/Mime/BodyRenderer.php | 2 +- .../Bridge/Twig/Tests/Mime/BodyRendererTest.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Twig/Mime/BodyRenderer.php b/src/Symfony/Bridge/Twig/Mime/BodyRenderer.php index e082d8313b..5e75a69bb3 100644 --- a/src/Symfony/Bridge/Twig/Mime/BodyRenderer.php +++ b/src/Symfony/Bridge/Twig/Mime/BodyRenderer.php @@ -74,6 +74,6 @@ final class BodyRenderer implements BodyRendererInterface return $this->converter->convert($html); } - return strip_tags(preg_replace('{<(head|style)\b.*?}i', '', $html)); + return strip_tags(preg_replace('{<(head|style)\b.*?}is', '', $html)); } } diff --git a/src/Symfony/Bridge/Twig/Tests/Mime/BodyRendererTest.php b/src/Symfony/Bridge/Twig/Tests/Mime/BodyRendererTest.php index 5d3d1d3ff2..316d41c159 100644 --- a/src/Symfony/Bridge/Twig/Tests/Mime/BodyRendererTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Mime/BodyRendererTest.php @@ -37,6 +37,23 @@ class BodyRendererTest extends TestCase $this->assertEquals(str_replace('=', '=3D', $html), $body->getParts()[1]->bodyToString()); } + public function testRenderMultiLineHtmlOnly() + { + $html = << + + +HTML +HTML; + $email = $this->prepareEmail(null, $html); + $body = $email->getBody(); + $this->assertInstanceOf(AlternativePart::class, $body); + $this->assertEquals('HTML', str_replace(["\r", "\n"], '', $body->getParts()[0]->bodyToString())); + $this->assertEquals(str_replace(['=', "\n"], ['=3D', "\r\n"], $html), $body->getParts()[1]->bodyToString()); + } + public function testRenderHtmlOnlyWithTextSet() { $email = $this->prepareEmail(null, 'HTML'); From 08fb696dbc30ffcf35e1f63d1418dbd4948f7ff1 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 4 Jan 2021 16:44:05 +0100 Subject: [PATCH 04/10] fix code style --- .../Tests/DependencyInjection/Fixtures/php/full.php | 2 +- .../Tests/DependencyInjection/Fixtures/php/workflows.php | 2 +- .../Tests/Fixtures/ClassAliasExampleClass.php | 2 +- .../FrameworkBundle/Tests/Fixtures/Validation/Category.php | 2 +- .../Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php | 1 - src/Symfony/Component/Config/Definition/Processor.php | 4 ++-- .../Component/Console/Tests/Fixtures/DummyOutput.php | 2 +- .../Component/DependencyInjection/Dumper/PhpDumper.php | 1 - .../Component/DependencyInjection/Loader/XmlFileLoader.php | 2 +- .../Component/DependencyInjection/Loader/YamlFileLoader.php | 2 +- .../Tests/Fixtures/CheckTypeDeclarationsPass/Foo.php | 2 +- .../DependencyInjection/Tests/Fixtures/FactoryDummy.php | 2 +- .../MultipleArgumentsOptionalScalarNotReallyOptional.php | 1 - .../DataTransformer/PercentToLocalizedStringTransformer.php | 2 +- src/Symfony/Component/Form/Extension/Core/Type/TimeType.php | 2 +- src/Symfony/Component/HttpFoundation/JsonResponse.php | 2 +- src/Symfony/Component/HttpFoundation/RedirectResponse.php | 2 +- src/Symfony/Component/HttpFoundation/Response.php | 2 +- src/Symfony/Component/HttpFoundation/StreamedResponse.php | 2 +- src/Symfony/Component/Ldap/Tests/LdapTestCase.php | 2 +- .../Mailer/Bridge/Amazon/Transport/SesTransportFactory.php | 2 +- src/Symfony/Component/Mailer/Tests/TransportTest.php | 2 +- .../Messenger/Bridge/Amqp/Tests/Fixtures/long_receiver.php | 6 +++--- .../Bridge/Doctrine/Tests/Transport/ConnectionTest.php | 2 +- src/Symfony/Component/Messenger/RoutableMessageBus.php | 2 +- .../Component/Mime/Test/Constraint/EmailAddressContains.php | 2 +- .../Security/Http/Authenticator/AbstractAuthenticator.php | 2 +- .../Serializer/Tests/Fixtures/AbstractNormalizerDummy.php | 2 +- .../Tests/Mapping/Loader/AnnotationLoaderTest.php | 2 +- 29 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php index b11b5e08dc..665d0f213b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php @@ -50,7 +50,7 @@ $container->loadFromExtension('framework', [ 'fallback' => 'fr', 'paths' => ['%kernel.project_dir%/Fixtures/translations'], 'cache_dir' => '%kernel.cache_dir%/translations', - 'enabled_locales' => ['fr', 'en'] + 'enabled_locales' => ['fr', 'en'], ], 'validation' => [ 'enabled' => true, diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows.php index d0abe507e5..995fabffe3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows.php @@ -12,7 +12,7 @@ $container->loadFromExtension('framework', [ 'initial_marking' => ['draft'], 'metadata' => [ 'title' => 'article workflow', - 'description' => 'workflow for articles' + 'description' => 'workflow for articles', ], 'places' => [ 'draft', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/ClassAliasExampleClass.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/ClassAliasExampleClass.php index c129865859..8303dc6ea1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/ClassAliasExampleClass.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/ClassAliasExampleClass.php @@ -4,7 +4,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures; class_alias( ClassAliasTargetClass::class, - __NAMESPACE__ . '\ClassAliasExampleClass' + __NAMESPACE__.'\ClassAliasExampleClass' ); if (false) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Category.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Category.php index 115320f667..6d9539cc58 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Category.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Category.php @@ -6,7 +6,7 @@ use Symfony\Component\Validator\Constraints as Assert; class Category { - const NAME_PATTERN = '/\w+/'; + public const NAME_PATTERN = '/\w+/'; public $id; diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php index 648e4313d8..82441bdbc4 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php @@ -15,7 +15,6 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver\AbstractMySQLDriver; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\Schema; -use Doctrine\DBAL\Version; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\PdoAdapter; use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait; diff --git a/src/Symfony/Component/Config/Definition/Processor.php b/src/Symfony/Component/Config/Definition/Processor.php index 76f4700473..1bb6d795e5 100644 --- a/src/Symfony/Component/Config/Definition/Processor.php +++ b/src/Symfony/Component/Config/Definition/Processor.php @@ -84,10 +84,10 @@ class Processor if (isset($config[$key])) { if (\is_string($config[$key]) || !\is_int(key($config[$key]))) { // only one - return [$config[$key]]; + return [$config[$key]]; } - return $config[$key]; + return $config[$key]; } return []; diff --git a/src/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php b/src/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php index 96de7e7189..44b39e30b4 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php +++ b/src/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php @@ -23,7 +23,7 @@ class DummyOutput extends BufferedOutput public function getLogs(): array { $logs = []; - foreach (explode(PHP_EOL, trim($this->fetch())) as $message) { + foreach (explode(\PHP_EOL, trim($this->fetch())) as $message) { preg_match('/^\[(.*)\] (.*)/', $message, $matches); $logs[] = sprintf('%s %s', $matches[1], $matches[2]); } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 53925bf0bf..c91f8d58d2 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -21,7 +21,6 @@ use Symfony\Component\DependencyInjection\Argument\ServiceLocator; use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument; use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass; -use Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphEdge; use Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphNode; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index d99217bde6..a70b12a279 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -478,7 +478,7 @@ class XmlFileLoader extends FileLoader break; case 'expression': if (!class_exists(Expression::class)) { - throw new \LogicException(sprintf('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".')); + throw new \LogicException('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'); } $arguments[$key] = new Expression($arg->nodeValue); diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 112736c401..903b15ac84 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -868,7 +868,7 @@ class YamlFileLoader extends FileLoader } } elseif (\is_string($value) && 0 === strpos($value, '@=')) { if (!class_exists(Expression::class)) { - throw new \LogicException(sprintf('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".')); + throw new \LogicException('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'); } return new Expression(substr($value, 2)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CheckTypeDeclarationsPass/Foo.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CheckTypeDeclarationsPass/Foo.php index 34998824c5..be92ec5c29 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CheckTypeDeclarationsPass/Foo.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CheckTypeDeclarationsPass/Foo.php @@ -16,7 +16,7 @@ class Foo public static function createCallable(): callable { - return function() {}; + return function () {}; } public static function createArray(): array diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/FactoryDummy.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/FactoryDummy.php index b7ceac7d8a..ad4d62ad0e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/FactoryDummy.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/FactoryDummy.php @@ -13,7 +13,7 @@ namespace Symfony\Component\DependencyInjection\Tests\Fixtures; class FactoryDummy extends FactoryParent { - public static function createFactory(): FactoryDummy + public static function createFactory(): self { } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/MultipleArgumentsOptionalScalarNotReallyOptional.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/MultipleArgumentsOptionalScalarNotReallyOptional.php index dcaaacc1f4..754470a413 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/MultipleArgumentsOptionalScalarNotReallyOptional.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/MultipleArgumentsOptionalScalarNotReallyOptional.php @@ -11,4 +11,3 @@ class MultipleArgumentsOptionalScalarNotReallyOptional { } } - diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php index 61b2e20de3..46e01f3309 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php @@ -204,7 +204,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface { if (null !== $this->scale && null !== $this->roundingMode) { // shift number to maintain the correct scale during rounding - $roundingCoef = pow(10, $this->scale); + $roundingCoef = 10 ** $this->scale; if (self::FRACTIONAL == $this->type) { $roundingCoef *= 100; diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index 56718c827b..b71eced783 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -340,7 +340,7 @@ class TimeType extends AbstractType $resolver->setNormalizer('view_timezone', function (Options $options, $viewTimezone): ?string { if (null !== $options['model_timezone'] && $viewTimezone !== $options['model_timezone'] && null === $options['reference_date']) { - throw new LogicException(sprintf('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.')); + throw new LogicException('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.'); } return $viewTimezone; diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php index ff317a734a..5d73c6faed 100644 --- a/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -72,7 +72,7 @@ class JsonResponse extends Response */ public static function create($data = null, int $status = 200, array $headers = []) { - trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class()); + trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class); return new static($data, $status, $headers); } diff --git a/src/Symfony/Component/HttpFoundation/RedirectResponse.php b/src/Symfony/Component/HttpFoundation/RedirectResponse.php index c00548348f..5fc5322a06 100644 --- a/src/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/src/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -58,7 +58,7 @@ class RedirectResponse extends Response */ public static function create($url = '', int $status = 302, array $headers = []) { - trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class()); + trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class); return new static($url, $status, $headers); } diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 981b93532f..07f6814179 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -234,7 +234,7 @@ class Response */ public static function create(?string $content = '', int $status = 200, array $headers = []) { - trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class()); + trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class); return new static($content, $status, $headers); } diff --git a/src/Symfony/Component/HttpFoundation/StreamedResponse.php b/src/Symfony/Component/HttpFoundation/StreamedResponse.php index 7cbf453188..676cd66875 100644 --- a/src/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/src/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -52,7 +52,7 @@ class StreamedResponse extends Response */ public static function create($callback = null, int $status = 200, array $headers = []) { - trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class()); + trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class); return new static($callback, $status, $headers); } diff --git a/src/Symfony/Component/Ldap/Tests/LdapTestCase.php b/src/Symfony/Component/Ldap/Tests/LdapTestCase.php index 606065e491..dad9f03d0c 100644 --- a/src/Symfony/Component/Ldap/Tests/LdapTestCase.php +++ b/src/Symfony/Component/Ldap/Tests/LdapTestCase.php @@ -9,7 +9,7 @@ class LdapTestCase extends TestCase protected function getLdapConfig() { $h = @ldap_connect(getenv('LDAP_HOST'), getenv('LDAP_PORT')); - @ldap_set_option($h, LDAP_OPT_PROTOCOL_VERSION, 3); + @ldap_set_option($h, \LDAP_OPT_PROTOCOL_VERSION, 3); if (!$h || !@ldap_bind($h)) { $this->markTestSkipped('No server is listening on LDAP_HOST:LDAP_PORT'); diff --git a/src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesTransportFactory.php b/src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesTransportFactory.php index 9d6863f12e..758dc3bd35 100644 --- a/src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesTransportFactory.php +++ b/src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesTransportFactory.php @@ -40,7 +40,7 @@ final class SesTransportFactory extends AbstractTransportFactory throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component or AsyncAws package is not installed. Try running "composer require async-aws/ses".', __CLASS__)); } - trigger_deprecation('symfony/amazon-mailer', '5.1', 'Using the "%s" transport without AsyncAws is deprecated. Try running "composer require async-aws/ses".', $scheme, \get_called_class()); + trigger_deprecation('symfony/amazon-mailer', '5.1', 'Using the "%s" transport without AsyncAws is deprecated. Try running "composer require async-aws/ses".', $scheme, static::class); $user = $this->getUser($dsn); $password = $this->getPassword($dsn); diff --git a/src/Symfony/Component/Mailer/Tests/TransportTest.php b/src/Symfony/Component/Mailer/Tests/TransportTest.php index dfd8d1926e..0327a3902f 100644 --- a/src/Symfony/Component/Mailer/Tests/TransportTest.php +++ b/src/Symfony/Component/Mailer/Tests/TransportTest.php @@ -116,7 +116,7 @@ class DummyTransport implements Transport\TransportInterface public function __toString(): string { - return sprintf('dummy://local'); + return 'dummy://local'; } } diff --git a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Fixtures/long_receiver.php b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Fixtures/long_receiver.php index 0c7740666c..441d45f503 100644 --- a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Fixtures/long_receiver.php +++ b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Fixtures/long_receiver.php @@ -13,12 +13,12 @@ if (!file_exists($autoload)) { require_once $autoload; use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceiver; +use Symfony\Component\Messenger\Bridge\Amqp\Transport\Connection; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\EventListener\DispatchPcntlSignalListener; use Symfony\Component\Messenger\EventListener\StopWorkerOnSigtermSignalListener; use Symfony\Component\Messenger\MessageBusInterface; -use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceiver; -use Symfony\Component\Messenger\Bridge\Amqp\Transport\Connection; use Symfony\Component\Messenger\Transport\Serialization\Serializer; use Symfony\Component\Messenger\Worker; use Symfony\Component\Serializer as SerializerComponent; @@ -40,7 +40,7 @@ $worker = new Worker(['the_receiver' => $receiver], new class() implements Messa public function dispatch($envelope, array $stamps = []): Envelope { echo 'Get envelope with message: '.get_class($envelope->getMessage())."\n"; - echo sprintf("with stamps: %s\n", json_encode(array_keys($envelope->all()), JSON_PRETTY_PRINT)); + echo sprintf("with stamps: %s\n", json_encode(array_keys($envelope->all()), \JSON_PRETTY_PRINT)); sleep(30); echo "Done.\n"; diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/ConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/ConnectionTest.php index 0e0639276c..ff616ec293 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/ConnectionTest.php @@ -194,7 +194,7 @@ class ConnectionTest extends TestCase 'expectedAutoSetup' => true, ]; - yield 'test options array' => [ + yield 'test options array' => [ 'dsn' => 'doctrine://default', 'options' => [ 'table_name' => 'name_from_options', diff --git a/src/Symfony/Component/Messenger/RoutableMessageBus.php b/src/Symfony/Component/Messenger/RoutableMessageBus.php index a4a663589f..8b7bedf731 100644 --- a/src/Symfony/Component/Messenger/RoutableMessageBus.php +++ b/src/Symfony/Component/Messenger/RoutableMessageBus.php @@ -45,7 +45,7 @@ class RoutableMessageBus implements MessageBusInterface if (null === $busNameStamp) { if (null === $this->fallbackBus) { - throw new InvalidArgumentException(sprintf('Envelope is missing a BusNameStamp and no fallback message bus is configured on RoutableMessageBus.')); + throw new InvalidArgumentException('Envelope is missing a BusNameStamp and no fallback message bus is configured on RoutableMessageBus.'); } return $this->fallbackBus->dispatch($envelope, $stamps); diff --git a/src/Symfony/Component/Mime/Test/Constraint/EmailAddressContains.php b/src/Symfony/Component/Mime/Test/Constraint/EmailAddressContains.php index c751c3d45f..827e141472 100644 --- a/src/Symfony/Component/Mime/Test/Constraint/EmailAddressContains.php +++ b/src/Symfony/Component/Mime/Test/Constraint/EmailAddressContains.php @@ -59,7 +59,7 @@ final class EmailAddressContains extends Constraint return false; } - throw new \LogicException(sprintf('Unable to test a message address on a non-address header.')); + throw new \LogicException('Unable to test a message address on a non-address header.'); } /** diff --git a/src/Symfony/Component/Security/Http/Authenticator/AbstractAuthenticator.php b/src/Symfony/Component/Security/Http/Authenticator/AbstractAuthenticator.php index 6a5ec2f150..d479e6a070 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/AbstractAuthenticator.php +++ b/src/Symfony/Component/Security/Http/Authenticator/AbstractAuthenticator.php @@ -35,7 +35,7 @@ abstract class AbstractAuthenticator implements AuthenticatorInterface public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface { if (!$passport instanceof UserPassportInterface) { - throw new LogicException(sprintf('Passport does not contain a user, overwrite "createAuthenticatedToken()" in "%s" to create a custom authenticated token.', \get_class($this))); + throw new LogicException(sprintf('Passport does not contain a user, overwrite "createAuthenticatedToken()" in "%s" to create a custom authenticated token.', static::class)); } return new PostAuthenticationToken($passport->getUser(), $firewallName, $passport->getUser()->getRoles()); diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php index 7b53f3bf08..ae3b411b31 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php @@ -23,7 +23,7 @@ class AbstractNormalizerDummy extends AbstractNormalizer /** * {@inheritdoc} */ - public function getAllowedAttributes($classOrObject, array $context, bool $attributesAsString = false) + public function getAllowedAttributes($classOrObject, array $context, bool $attributesAsString = false) { return parent::getAllowedAttributes($classOrObject, $context, $attributesAsString); } diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php index 9c5a9943e3..2470d94acb 100644 --- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php @@ -20,8 +20,8 @@ use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummy; use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummyFirstChild; use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummySecondChild; -use Symfony\Component\Serializer\Tests\Fixtures\IgnoreDummy; use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummyThirdChild; +use Symfony\Component\Serializer\Tests\Fixtures\IgnoreDummy; use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory; /** From a33850e838522739e4fc1bc993be530223e917a8 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 5 Jan 2021 09:52:12 +0100 Subject: [PATCH 05/10] make some time dependent tests more resilient --- .../Config/Tests/Resource/DirectoryResourceTest.php | 2 +- .../Mailer/Tests/Transport/Smtp/SmtpTransportTest.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php index fbaed34a21..a956acd87f 100644 --- a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php @@ -110,7 +110,7 @@ class DirectoryResourceTest extends TestCase { $resource = new DirectoryResource($this->directory); $time = time(); - sleep(1); + usleep(1500000); unlink($this->directory.'/tmp.xml'); $this->assertFalse($resource->isFresh($time), '->isFresh() returns false if an existing file is removed'); } diff --git a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/SmtpTransportTest.php b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/SmtpTransportTest.php index 91b1685077..72130dcee4 100644 --- a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/SmtpTransportTest.php +++ b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/SmtpTransportTest.php @@ -22,6 +22,9 @@ use Symfony\Component\Mime\Email; use Symfony\Component\Mime\Exception\InvalidArgumentException; use Symfony\Component\Mime\RawMessage; +/** + * @group time-sensitive + */ class SmtpTransportTest extends TestCase { public function testToString() @@ -83,7 +86,7 @@ class SmtpTransportTest extends TestCase $this->assertNotContains("NOOP\r\n", $stream->getCommands()); $stream->clearCommands(); - sleep(1); + usleep(1500000); $transport->send(new RawMessage('Message 3'), $envelope); $this->assertContains("NOOP\r\n", $stream->getCommands()); From 29d2da572e2c24ee14398dbf6479f40fbee3ec57 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 2 Jan 2021 13:40:41 +0100 Subject: [PATCH 06/10] parse cookie values containing the equal sign --- .../Component/HttpFoundation/HeaderUtils.php | 19 +++++- .../HttpFoundation/Tests/CookieTest.php | 6 ++ .../HttpFoundation/Tests/HeaderUtilsTest.php | 62 ++++++++++++------- 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/HeaderUtils.php b/src/Symfony/Component/HttpFoundation/HeaderUtils.php index f4add930eb..fddf2512c4 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderUtils.php +++ b/src/Symfony/Component/HttpFoundation/HeaderUtils.php @@ -193,17 +193,23 @@ class HeaderUtils return $disposition.'; '.self::toString($params, ';'); } - private static function groupParts(array $matches, string $separators): array + private static function groupParts(array $matches, string $separators, bool $first = true): array { $separator = $separators[0]; $partSeparators = substr($separators, 1); $i = 0; $partMatches = []; + $previousMatchWasSeparator = false; foreach ($matches as $match) { - if (isset($match['separator']) && $match['separator'] === $separator) { + if (!$first && $previousMatchWasSeparator && isset($match['separator']) && $match['separator'] === $separator) { + $previousMatchWasSeparator = true; + $partMatches[$i][] = $match; + } elseif (isset($match['separator']) && $match['separator'] === $separator) { + $previousMatchWasSeparator = true; ++$i; } else { + $previousMatchWasSeparator = false; $partMatches[$i][] = $match; } } @@ -211,12 +217,19 @@ class HeaderUtils $parts = []; if ($partSeparators) { foreach ($partMatches as $matches) { - $parts[] = self::groupParts($matches, $partSeparators); + $parts[] = self::groupParts($matches, $partSeparators, false); } } else { foreach ($partMatches as $matches) { $parts[] = self::unquote($matches[0][0]); } + + if (!$first && 2 < \count($parts)) { + $parts = [ + $parts[0], + implode($separator, \array_slice($parts, 1)), + ]; + } } return $parts; diff --git a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php index 55287e082d..e39ca673e0 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php @@ -227,6 +227,12 @@ class CookieTest extends TestCase $cookie = Cookie::fromString('foo', true); $this->assertEquals(Cookie::create('foo', null, 0, '/', null, false, false, false, null), $cookie); + + $cookie = Cookie::fromString('foo_cookie=foo=1&bar=2&baz=3; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/'); + $this->assertEquals(Cookie::create('foo_cookie', 'foo=1&bar=2&baz=3', strtotime('Tue, 22-Sep-2020 06:27:09 GMT'), '/', null, false, false, true, null), $cookie); + + $cookie = Cookie::fromString('foo_cookie=foo==; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/'); + $this->assertEquals(Cookie::create('foo_cookie', 'foo==', strtotime('Tue, 22-Sep-2020 06:27:09 GMT'), '/', null, false, false, true, null), $cookie); } public function testFromStringWithHttpOnly() diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderUtilsTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderUtilsTest.php index d2b19ca84d..eafcd9311b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/HeaderUtilsTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderUtilsTest.php @@ -16,33 +16,47 @@ use Symfony\Component\HttpFoundation\HeaderUtils; class HeaderUtilsTest extends TestCase { - public function testSplit() + /** + * @dataProvider provideHeaderToSplit + */ + public function testSplit(array $expected, string $header, string $separator) { - $this->assertSame(['foo=123', 'bar'], HeaderUtils::split('foo=123,bar', ',')); - $this->assertSame(['foo=123', 'bar'], HeaderUtils::split('foo=123, bar', ',')); - $this->assertSame([['foo=123', 'bar']], HeaderUtils::split('foo=123; bar', ',;')); - $this->assertSame([['foo=123'], ['bar']], HeaderUtils::split('foo=123, bar', ',;')); - $this->assertSame(['foo', '123, bar'], HeaderUtils::split('foo=123, bar', '=')); - $this->assertSame(['foo', '123, bar'], HeaderUtils::split(' foo = 123, bar ', '=')); - $this->assertSame([['foo', '123'], ['bar']], HeaderUtils::split('foo=123, bar', ',=')); - $this->assertSame([[['foo', '123']], [['bar'], ['foo', '456']]], HeaderUtils::split('foo=123, bar; foo=456', ',;=')); - $this->assertSame([[['foo', 'a,b;c=d']]], HeaderUtils::split('foo="a,b;c=d"', ',;=')); + $this->assertSame($expected, HeaderUtils::split($header, $separator)); + } - $this->assertSame(['foo', 'bar'], HeaderUtils::split('foo,,,, bar', ',')); - $this->assertSame(['foo', 'bar'], HeaderUtils::split(',foo, bar,', ',')); - $this->assertSame(['foo', 'bar'], HeaderUtils::split(' , foo, bar, ', ',')); - $this->assertSame(['foo bar'], HeaderUtils::split('foo "bar"', ',')); - $this->assertSame(['foo bar'], HeaderUtils::split('"foo" bar', ',')); - $this->assertSame(['foo bar'], HeaderUtils::split('"foo" "bar"', ',')); + public function provideHeaderToSplit(): array + { + return [ + [['foo=123', 'bar'], 'foo=123,bar', ','], + [['foo=123', 'bar'], 'foo=123, bar', ','], + [[['foo=123', 'bar']], 'foo=123; bar', ',;'], + [[['foo=123'], ['bar']], 'foo=123, bar', ',;'], + [['foo', '123, bar'], 'foo=123, bar', '='], + [['foo', '123, bar'], ' foo = 123, bar ', '='], + [[['foo', '123'], ['bar']], 'foo=123, bar', ',='], + [[[['foo', '123']], [['bar'], ['foo', '456']]], 'foo=123, bar; foo=456', ',;='], + [[[['foo', 'a,b;c=d']]], 'foo="a,b;c=d"', ',;='], - // These are not a valid header values. We test that they parse anyway, - // and that both the valid and invalid parts are returned. - $this->assertSame([], HeaderUtils::split('', ',')); - $this->assertSame([], HeaderUtils::split(',,,', ',')); - $this->assertSame(['foo', 'bar', 'baz'], HeaderUtils::split('foo, "bar", "baz', ',')); - $this->assertSame(['foo', 'bar, baz'], HeaderUtils::split('foo, "bar, baz', ',')); - $this->assertSame(['foo', 'bar, baz\\'], HeaderUtils::split('foo, "bar, baz\\', ',')); - $this->assertSame(['foo', 'bar, baz\\'], HeaderUtils::split('foo, "bar, baz\\\\', ',')); + [['foo', 'bar'], 'foo,,,, bar', ','], + [['foo', 'bar'], ',foo, bar,', ','], + [['foo', 'bar'], ' , foo, bar, ', ','], + [['foo bar'], 'foo "bar"', ','], + [['foo bar'], '"foo" bar', ','], + [['foo bar'], '"foo" "bar"', ','], + + [[['foo_cookie', 'foo=1&bar=2&baz=3'], ['expires', 'Tue, 22-Sep-2020 06:27:09 GMT'], ['path', '/']], 'foo_cookie=foo=1&bar=2&baz=3; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/', ';='], + [[['foo_cookie', 'foo=='], ['expires', 'Tue, 22-Sep-2020 06:27:09 GMT'], ['path', '/']], 'foo_cookie=foo==; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/', ';='], + [[['foo_cookie', 'foo=a=b'], ['expires', 'Tue, 22-Sep-2020 06:27:09 GMT'], ['path', '/']], 'foo_cookie=foo="a=b"; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/', ';='], + + // These are not a valid header values. We test that they parse anyway, + // and that both the valid and invalid parts are returned. + [[], '', ','], + [[], ',,,', ','], + [['foo', 'bar', 'baz'], 'foo, "bar", "baz', ','], + [['foo', 'bar, baz'], 'foo, "bar, baz', ','], + [['foo', 'bar, baz\\'], 'foo, "bar, baz\\', ','], + [['foo', 'bar, baz\\'], 'foo, "bar, baz\\\\', ','], + ]; } public function testCombine() From 8f9f370f076cdf9064a9c5a249853e98409a3f8f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 5 Jan 2021 16:52:18 +0100 Subject: [PATCH 07/10] stop using void in test files --- .../Form/Tests/Extension/Core/Type/NumberTypeTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php index af9354b7be..c8c2a70c10 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php @@ -77,7 +77,7 @@ class NumberTypeTest extends BaseTypeTest $this->assertSame('12345,68', $form->createView()->vars['value']); } - public function testStringInputWithFloatData(): void + public function testStringInputWithFloatData() { $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $this->expectExceptionMessage('Expected a numeric string.'); @@ -88,7 +88,7 @@ class NumberTypeTest extends BaseTypeTest ]); } - public function testStringInputWithIntData(): void + public function testStringInputWithIntData() { $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $this->expectExceptionMessage('Expected a numeric string.'); From 44392cbc308e5fd9159430b6345609c0cf89756a Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Tue, 5 Jan 2021 18:11:49 +0100 Subject: [PATCH 08/10] [Uid] Use the Uuid constructor when reconstructing an Ulid from its RFC-4122 version --- src/Symfony/Component/Uid/Ulid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Uid/Ulid.php b/src/Symfony/Component/Uid/Ulid.php index fb0bfb8bdd..d436ba65fc 100644 --- a/src/Symfony/Component/Uid/Ulid.php +++ b/src/Symfony/Component/Uid/Ulid.php @@ -59,7 +59,7 @@ class Ulid extends AbstractUid public static function fromString(string $ulid): parent { if (36 === \strlen($ulid) && Uuid::isValid($ulid)) { - $ulid = Uuid::fromString($ulid)->toBinary(); + $ulid = (new Uuid($ulid))->toBinary(); } elseif (22 === \strlen($ulid) && 22 === strspn($ulid, BinaryUtil::BASE58[''])) { $ulid = BinaryUtil::fromBase($ulid, BinaryUtil::BASE58); } From f0fafec01992ba4114660967516af50d07e3c831 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Tue, 5 Jan 2021 18:18:34 +0100 Subject: [PATCH 09/10] [Uid] Hardcode UuidV3 & UuidV5 TYPE conditional constants --- src/Symfony/Component/Uid/NilUuid.php | 2 +- src/Symfony/Component/Uid/Uuid.php | 2 +- src/Symfony/Component/Uid/UuidV1.php | 2 +- src/Symfony/Component/Uid/UuidV3.php | 2 +- src/Symfony/Component/Uid/UuidV4.php | 2 +- src/Symfony/Component/Uid/UuidV5.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Uid/NilUuid.php b/src/Symfony/Component/Uid/NilUuid.php index b5ff73a476..6cf333a187 100644 --- a/src/Symfony/Component/Uid/NilUuid.php +++ b/src/Symfony/Component/Uid/NilUuid.php @@ -18,7 +18,7 @@ namespace Symfony\Component\Uid; */ class NilUuid extends Uuid { - protected const TYPE = \UUID_TYPE_NULL; + protected const TYPE = -1; public function __construct() { diff --git a/src/Symfony/Component/Uid/Uuid.php b/src/Symfony/Component/Uid/Uuid.php index 06150033d6..87a285b9c3 100644 --- a/src/Symfony/Component/Uid/Uuid.php +++ b/src/Symfony/Component/Uid/Uuid.php @@ -18,7 +18,7 @@ namespace Symfony\Component\Uid; */ class Uuid extends AbstractUid { - protected const TYPE = \UUID_TYPE_DEFAULT; + protected const TYPE = 0; public function __construct(string $uuid) { diff --git a/src/Symfony/Component/Uid/UuidV1.php b/src/Symfony/Component/Uid/UuidV1.php index 5f2d7e6a8a..f4f91361cf 100644 --- a/src/Symfony/Component/Uid/UuidV1.php +++ b/src/Symfony/Component/Uid/UuidV1.php @@ -20,7 +20,7 @@ namespace Symfony\Component\Uid; */ class UuidV1 extends Uuid { - protected const TYPE = \UUID_TYPE_TIME; + protected const TYPE = 1; public function __construct(string $uuid = null) { diff --git a/src/Symfony/Component/Uid/UuidV3.php b/src/Symfony/Component/Uid/UuidV3.php index d5d0d8fe86..80b40c15eb 100644 --- a/src/Symfony/Component/Uid/UuidV3.php +++ b/src/Symfony/Component/Uid/UuidV3.php @@ -22,5 +22,5 @@ namespace Symfony\Component\Uid; */ class UuidV3 extends Uuid { - protected const TYPE = \UUID_TYPE_MD5; + protected const TYPE = 3; } diff --git a/src/Symfony/Component/Uid/UuidV4.php b/src/Symfony/Component/Uid/UuidV4.php index d338f1eb0c..decb2819cf 100644 --- a/src/Symfony/Component/Uid/UuidV4.php +++ b/src/Symfony/Component/Uid/UuidV4.php @@ -20,7 +20,7 @@ namespace Symfony\Component\Uid; */ class UuidV4 extends Uuid { - protected const TYPE = \UUID_TYPE_RANDOM; + protected const TYPE = 4; public function __construct(string $uuid = null) { diff --git a/src/Symfony/Component/Uid/UuidV5.php b/src/Symfony/Component/Uid/UuidV5.php index 59a6a2082c..d63324eccb 100644 --- a/src/Symfony/Component/Uid/UuidV5.php +++ b/src/Symfony/Component/Uid/UuidV5.php @@ -22,5 +22,5 @@ namespace Symfony\Component\Uid; */ class UuidV5 extends Uuid { - protected const TYPE = \UUID_TYPE_SHA1; + protected const TYPE = 5; } From 0fdf59c26dec4f996bcfdd1eac0ce2d199fc1d10 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 5 Jan 2021 10:01:01 +0100 Subject: [PATCH 10/10] fix code style --- .../HttpCodeActivationStrategyTest.php | 10 +++++----- .../NotFoundActivationStrategyTest.php | 4 ++-- .../Fixtures/php/http_client_retry.php | 2 +- .../php/workflow_with_no_events_to_dispatch.php | 8 ++++---- .../workflow_with_specified_events_to_dispatch.php | 8 ++++---- .../DependencyInjection/FrameworkExtensionTest.php | 2 +- .../DependencyInjection/SecurityExtensionTest.php | 2 +- .../Component/BrowserKit/Tests/RequestTest.php | 2 +- .../Component/Config/Definition/ArrayNode.php | 2 +- .../Tests/SignalRegistry/SignalRegistryTest.php | 10 +++++----- .../HttpClient/Response/TraceableResponse.php | 2 ++ .../HttpClient/Tests/Response/MockResponseTest.php | 2 +- .../Lock/Tests/Store/PostgreSqlDbalStoreTest.php | 2 +- .../Lock/Tests/Store/PostgreSqlStoreTest.php | 2 +- .../Tests/Transport/AmazonSqsSenderTest.php | 4 ++-- .../Bridge/Amqp/Tests/Transport/ConnectionTest.php | 2 +- .../AddErrorDetailsStampListenerTest.php | 2 +- .../Tests/Stamp/ErrorDetailsStampTest.php | 6 +++--- .../Notifier/Tests/Transport/TransportsTest.php | 8 ++++---- .../Notifier/Tests/TransportFactoryTestCase.php | 8 ++++---- .../Component/Notifier/Tests/TransportTestCase.php | 14 +++++++------- .../Tests/Extractor/ConstructorExtractorTest.php | 2 +- .../PropertyInfo/Util/PhpDocTypeHelper.php | 2 +- .../Authentication/AuthenticatorManagerTest.php | 4 ++-- .../Factory/ClassMetadataFactoryCompilerTest.php | 2 +- .../Factory/CompiledClassMetadataFactoryTest.php | 2 +- .../MetadataAwareNameConverterTest.php | 2 +- .../Tests/Normalizer/AbstractNormalizerTest.php | 2 +- .../Normalizer/GetSetMethodNormalizerTest.php | 2 +- .../Tests/Normalizer/PropertyNormalizerTest.php | 2 +- .../Tests/Normalizer/UidNormalizerTest.php | 1 - .../Tests/PseudoLocalizationTranslatorTest.php | 4 ++-- .../Component/Validator/Constraints/Regex.php | 2 +- .../Component/Validator/Constraints/Timezone.php | 2 +- .../Component/Validator/Constraints/Type.php | 2 +- .../Validator/Tests/Command/DebugCommandTest.php | 6 +++--- .../Tests/Constraints/LanguageValidatorTest.php | 1 - .../Tests/Fixtures/ConstraintChoiceWithPreset.php | 5 +++-- 38 files changed, 73 insertions(+), 72 deletions(-) diff --git a/src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/HttpCodeActivationStrategyTest.php b/src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/HttpCodeActivationStrategyTest.php index fdf2811876..fedbb83482 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/HttpCodeActivationStrategyTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/HttpCodeActivationStrategyTest.php @@ -24,7 +24,7 @@ class HttpCodeActivationStrategyTest extends TestCase /** * @group legacy */ - public function testExclusionsWithoutCodeLegacy(): void + public function testExclusionsWithoutCodeLegacy() { $this->expectException('LogicException'); new HttpCodeActivationStrategy(new RequestStack(), [['urls' => []]], Logger::WARNING); @@ -33,7 +33,7 @@ class HttpCodeActivationStrategyTest extends TestCase /** * @group legacy */ - public function testExclusionsWithoutUrlsLegacy(): void + public function testExclusionsWithoutUrlsLegacy() { $this->expectException('LogicException'); new HttpCodeActivationStrategy(new RequestStack(), [['code' => 404]], Logger::WARNING); @@ -44,7 +44,7 @@ class HttpCodeActivationStrategyTest extends TestCase * * @group legacy */ - public function testIsActivatedLegacy($url, $record, $expected): void + public function testIsActivatedLegacy($url, $record, $expected) { $requestStack = new RequestStack(); $requestStack->push(Request::create($url)); @@ -63,13 +63,13 @@ class HttpCodeActivationStrategyTest extends TestCase self::assertEquals($expected, $strategy->isHandlerActivated($record)); } - public function testExclusionsWithoutCode(): void + public function testExclusionsWithoutCode() { $this->expectException('LogicException'); new HttpCodeActivationStrategy(new RequestStack(), [['urls' => []]], new ErrorLevelActivationStrategy(Logger::WARNING)); } - public function testExclusionsWithoutUrls(): void + public function testExclusionsWithoutUrls() { $this->expectException('LogicException'); new HttpCodeActivationStrategy(new RequestStack(), [['code' => 404]], new ErrorLevelActivationStrategy(Logger::WARNING)); diff --git a/src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/NotFoundActivationStrategyTest.php b/src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/NotFoundActivationStrategyTest.php index 3d8445df3b..a60cc450c7 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/NotFoundActivationStrategyTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/NotFoundActivationStrategyTest.php @@ -26,7 +26,7 @@ class NotFoundActivationStrategyTest extends TestCase * * @group legacy */ - public function testIsActivatedLegacy(string $url, array $record, bool $expected): void + public function testIsActivatedLegacy(string $url, array $record, bool $expected) { $requestStack = new RequestStack(); $requestStack->push(Request::create($url)); @@ -39,7 +39,7 @@ class NotFoundActivationStrategyTest extends TestCase /** * @dataProvider isActivatedProvider */ - public function testIsActivated(string $url, array $record, bool $expected): void + public function testIsActivated(string $url, array $record, bool $expected) { $requestStack = new RequestStack(); $requestStack->push(Request::create($url)); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_retry.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_retry.php index 3260ac56a7..f2ab01d1e1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_retry.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_retry.php @@ -11,7 +11,7 @@ $container->loadFromExtension('framework', [ 'multiplier' => 2, 'max_delay' => 0, 'jitter' => 0.3, - ] + ], ], 'scoped_clients' => [ 'foo' => [ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_no_events_to_dispatch.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_no_events_to_dispatch.php index 0ae6ac69ee..e4eefd4c28 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_no_events_to_dispatch.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_no_events_to_dispatch.php @@ -8,7 +8,7 @@ $container->loadFromExtension('framework', [ 'type' => 'state_machine', 'marking_store' => [ 'type' => 'method', - 'property' => 'state' + 'property' => 'state', ], 'supports' => [ FrameworkExtensionTest::class, @@ -33,9 +33,9 @@ $container->loadFromExtension('framework', [ 'two', ], 'to' => [ - 'three' - ] - ] + 'three', + ], + ], ], ], ], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_specified_events_to_dispatch.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_specified_events_to_dispatch.php index 259ee5087f..0fc5c29c8b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_specified_events_to_dispatch.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_specified_events_to_dispatch.php @@ -8,7 +8,7 @@ $container->loadFromExtension('framework', [ 'type' => 'state_machine', 'marking_store' => [ 'type' => 'method', - 'property' => 'state' + 'property' => 'state', ], 'supports' => [ FrameworkExtensionTest::class, @@ -36,9 +36,9 @@ $container->loadFromExtension('framework', [ 'two', ], 'to' => [ - 'three' - ] - ] + 'three', + ], + ], ], ], ], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 72dc6db357..f2bd9a99db 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1371,7 +1371,7 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertEquals($expected, $chain->getArguments()); } - public function testRedisTagAwareAdapter(): void + public function testRedisTagAwareAdapter() { $container = $this->createContainerFromFile('cache', [], true); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php index 61e6287768..7c3443a06d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php @@ -629,7 +629,7 @@ class SecurityExtensionTest extends TestCase yield [['user_checker' => TestUserChecker::class], TestUserChecker::class]; } - public function testConfigureCustomFirewallListener(): void + public function testConfigureCustomFirewallListener() { $container = $this->getRawContainer(); /** @var SecurityExtension $extension */ diff --git a/src/Symfony/Component/BrowserKit/Tests/RequestTest.php b/src/Symfony/Component/BrowserKit/Tests/RequestTest.php index 5d7c7d6b89..a7327b0f32 100644 --- a/src/Symfony/Component/BrowserKit/Tests/RequestTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/RequestTest.php @@ -52,7 +52,7 @@ class RequestTest extends TestCase $this->assertEquals(['foo' => 'bar'], $request->getServer(), '->getServer() returns the server parameters of the request'); } - public function testAllParameterValuesAreConvertedToString(): void + public function testAllParameterValuesAreConvertedToString() { $parameters = [ 'foo' => 1, diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index 66291014ec..2f8fa75251 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -215,7 +215,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface if ($child->isRequired()) { $message = sprintf('The child config "%s" under "%s" must be configured', $name, $this->getPath()); if ($child->getInfo()) { - $message .= sprintf(": %s", $child->getInfo()); + $message .= sprintf(': %s', $child->getInfo()); } else { $message .= '.'; } diff --git a/src/Symfony/Component/Console/Tests/SignalRegistry/SignalRegistryTest.php b/src/Symfony/Component/Console/Tests/SignalRegistry/SignalRegistryTest.php index 56f7d44443..f1ac7c6900 100644 --- a/src/Symfony/Component/Console/Tests/SignalRegistry/SignalRegistryTest.php +++ b/src/Symfony/Component/Console/Tests/SignalRegistry/SignalRegistryTest.php @@ -26,7 +26,7 @@ class SignalRegistryTest extends TestCase pcntl_signal(\SIGUSR2, \SIG_DFL); } - public function testOneCallbackForASignal_signalIsHandled() + public function testOneCallbackForASignalSignalIsHandled() { $signalRegistry = new SignalRegistry(); @@ -40,7 +40,7 @@ class SignalRegistryTest extends TestCase $this->assertTrue($isHandled); } - public function testTwoCallbacksForASignal_bothCallbacksAreCalled() + public function testTwoCallbacksForASignalBothCallbacksAreCalled() { $signalRegistry = new SignalRegistry(); @@ -60,7 +60,7 @@ class SignalRegistryTest extends TestCase $this->assertTrue($isHandled2); } - public function testTwoSignals_signalsAreHandled() + public function testTwoSignalsSignalsAreHandled() { $signalRegistry = new SignalRegistry(); @@ -85,7 +85,7 @@ class SignalRegistryTest extends TestCase $this->assertTrue($isHandled2); } - public function testTwoCallbacksForASignal_previousAndRegisteredCallbacksWereCalled() + public function testTwoCallbacksForASignalPreviousAndRegisteredCallbacksWereCalled() { $signalRegistry = new SignalRegistry(); @@ -105,7 +105,7 @@ class SignalRegistryTest extends TestCase $this->assertTrue($isHandled2); } - public function testTwoCallbacksForASignal_previousCallbackFromAnotherRegistry() + public function testTwoCallbacksForASignalPreviousCallbackFromAnotherRegistry() { $signalRegistry1 = new SignalRegistry(); diff --git a/src/Symfony/Component/HttpClient/Response/TraceableResponse.php b/src/Symfony/Component/HttpClient/Response/TraceableResponse.php index 9e1a2d5e01..7e58e06b30 100644 --- a/src/Symfony/Component/HttpClient/Response/TraceableResponse.php +++ b/src/Symfony/Component/HttpClient/Response/TraceableResponse.php @@ -83,6 +83,7 @@ class TraceableResponse implements ResponseInterface, StreamableInterface if (false === $this->content) { return $this->response->getContent($throw); } + return $this->content = $this->response->getContent(false); } finally { if ($this->event && $this->event->isStarted()) { @@ -100,6 +101,7 @@ class TraceableResponse implements ResponseInterface, StreamableInterface if (false === $this->content) { return $this->response->toArray($throw); } + return $this->content = $this->response->toArray(false); } finally { if ($this->event && $this->event->isStarted()) { diff --git a/src/Symfony/Component/HttpClient/Tests/Response/MockResponseTest.php b/src/Symfony/Component/HttpClient/Tests/Response/MockResponseTest.php index a1b30c77c3..2ad9a1c379 100644 --- a/src/Symfony/Component/HttpClient/Tests/Response/MockResponseTest.php +++ b/src/Symfony/Component/HttpClient/Tests/Response/MockResponseTest.php @@ -33,7 +33,7 @@ class MockResponseTest extends TestCase $response->toArray(); } - public function testUrlHttpMethodMockResponse(): void + public function testUrlHttpMethodMockResponse() { $responseMock = new MockResponse(json_encode(['foo' => 'bar'])); $url = 'https://example.com/some-endpoint'; diff --git a/src/Symfony/Component/Lock/Tests/Store/PostgreSqlDbalStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PostgreSqlDbalStoreTest.php index 4c8ec0f7a1..6c007fabb3 100644 --- a/src/Symfony/Component/Lock/Tests/Store/PostgreSqlDbalStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/PostgreSqlDbalStoreTest.php @@ -24,8 +24,8 @@ use Symfony\Component\Lock\Store\PostgreSqlStore; */ class PostgreSqlDbalStoreTest extends AbstractStoreTest { - use SharedLockStoreTestTrait; use BlockingStoreTestTrait; + use SharedLockStoreTestTrait; /** * {@inheritdoc} diff --git a/src/Symfony/Component/Lock/Tests/Store/PostgreSqlStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PostgreSqlStoreTest.php index 3515f72a9e..d0358a8ef0 100644 --- a/src/Symfony/Component/Lock/Tests/Store/PostgreSqlStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/PostgreSqlStoreTest.php @@ -24,8 +24,8 @@ use Symfony\Component\Lock\Store\PostgreSqlStore; */ class PostgreSqlStoreTest extends AbstractStoreTest { - use SharedLockStoreTestTrait; use BlockingStoreTestTrait; + use SharedLockStoreTestTrait; /** * {@inheritdoc} diff --git a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/AmazonSqsSenderTest.php b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/AmazonSqsSenderTest.php index 412faf0807..6c3ac392bb 100644 --- a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/AmazonSqsSenderTest.php +++ b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/AmazonSqsSenderTest.php @@ -21,7 +21,7 @@ use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface; class AmazonSqsSenderTest extends TestCase { - public function testSend(): void + public function testSend() { $envelope = new Envelope(new DummyMessage('Oy')); $encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]]; @@ -38,7 +38,7 @@ class AmazonSqsSenderTest extends TestCase $sender->send($envelope); } - public function testSendWithAmazonSqsFifoStamp(): void + public function testSendWithAmazonSqsFifoStamp() { $envelope = (new Envelope(new DummyMessage('Oy'))) ->with($stamp = new AmazonSqsFifoStamp('testGroup', 'testDeduplicationId')); diff --git a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php index 36fde12505..3d9f415533 100644 --- a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php @@ -347,7 +347,7 @@ class ConnectionTest extends TestCase $factory->method('createQueue')->will($this->onConsecutiveCalls($amqpQueue0, $amqpQueue1)); $amqpExchange->expects($this->once())->method('declareExchange'); - $amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]); + $amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]); $amqpQueue0->expects($this->once())->method('declareQueue'); $amqpQueue0->expects($this->exactly(2))->method('bind')->withConsecutive( [self::DEFAULT_EXCHANGE_NAME, 'binding_key0'], diff --git a/src/Symfony/Component/Messenger/Tests/EventListener/AddErrorDetailsStampListenerTest.php b/src/Symfony/Component/Messenger/Tests/EventListener/AddErrorDetailsStampListenerTest.php index cc01567a3d..d63fcf8ef6 100644 --- a/src/Symfony/Component/Messenger/Tests/EventListener/AddErrorDetailsStampListenerTest.php +++ b/src/Symfony/Component/Messenger/Tests/EventListener/AddErrorDetailsStampListenerTest.php @@ -10,7 +10,7 @@ use Symfony\Component\Messenger\Stamp\ErrorDetailsStamp; final class AddErrorDetailsStampListenerTest extends TestCase { - public function testExceptionDetailsAreAdded(): void + public function testExceptionDetailsAreAdded() { $listener = new AddErrorDetailsStampListener(); diff --git a/src/Symfony/Component/Messenger/Tests/Stamp/ErrorDetailsStampTest.php b/src/Symfony/Component/Messenger/Tests/Stamp/ErrorDetailsStampTest.php index 98277931da..8d66537afa 100644 --- a/src/Symfony/Component/Messenger/Tests/Stamp/ErrorDetailsStampTest.php +++ b/src/Symfony/Component/Messenger/Tests/Stamp/ErrorDetailsStampTest.php @@ -25,7 +25,7 @@ use Symfony\Component\Serializer\Serializer as SymfonySerializer; class ErrorDetailsStampTest extends TestCase { - public function testGetters(): void + public function testGetters() { $exception = new \Exception('exception message'); $flattenException = FlattenException::createFromThrowable($exception); @@ -37,7 +37,7 @@ class ErrorDetailsStampTest extends TestCase $this->assertEquals($flattenException, $stamp->getFlattenException()); } - public function testUnwrappingHandlerFailedException(): void + public function testUnwrappingHandlerFailedException() { $wrappedException = new \Exception('I am inside', 123); $envelope = new Envelope(new \stdClass()); @@ -52,7 +52,7 @@ class ErrorDetailsStampTest extends TestCase $this->assertEquals($flattenException, $stamp->getFlattenException()); } - public function testDeserialization(): void + public function testDeserialization() { $exception = new \Exception('exception message'); $stamp = ErrorDetailsStamp::create($exception); diff --git a/src/Symfony/Component/Notifier/Tests/Transport/TransportsTest.php b/src/Symfony/Component/Notifier/Tests/Transport/TransportsTest.php index de3cc3fab8..f6eb36bb21 100644 --- a/src/Symfony/Component/Notifier/Tests/Transport/TransportsTest.php +++ b/src/Symfony/Component/Notifier/Tests/Transport/TransportsTest.php @@ -21,7 +21,7 @@ use Symfony\Component\Notifier\Transport\Transports; class TransportsTest extends TestCase { - public function testSendToTransportDefinedByMessage(): void + public function testSendToTransportDefinedByMessage() { $transports = new Transports([ 'one' => $one = $this->createMock(TransportInterface::class), @@ -39,7 +39,7 @@ class TransportsTest extends TestCase $this->assertSame('one', $sentMessage->getTransport()); } - public function testSendToFirstSupportedTransportIfMessageDoesNotDefineATransport(): void + public function testSendToFirstSupportedTransportIfMessageDoesNotDefineATransport() { $transports = new Transports([ 'one' => $one = $this->createMock(TransportInterface::class), @@ -63,7 +63,7 @@ class TransportsTest extends TestCase $this->assertSame('two', $sentMessage->getTransport()); } - public function testThrowExceptionIfNoSupportedTransportWasFound(): void + public function testThrowExceptionIfNoSupportedTransportWasFound() { $transports = new Transports([ 'one' => $one = $this->createMock(TransportInterface::class), @@ -79,7 +79,7 @@ class TransportsTest extends TestCase $transports->send($message); } - public function testThrowExceptionIfTransportDefinedByMessageIsNotSupported(): void + public function testThrowExceptionIfTransportDefinedByMessageIsNotSupported() { $transports = new Transports([ 'one' => $one = $this->createMock(TransportInterface::class), diff --git a/src/Symfony/Component/Notifier/Tests/TransportFactoryTestCase.php b/src/Symfony/Component/Notifier/Tests/TransportFactoryTestCase.php index db415975b2..be3da0ff34 100644 --- a/src/Symfony/Component/Notifier/Tests/TransportFactoryTestCase.php +++ b/src/Symfony/Component/Notifier/Tests/TransportFactoryTestCase.php @@ -55,7 +55,7 @@ abstract class TransportFactoryTestCase extends TestCase /** * @dataProvider supportsProvider */ - public function testSupports(bool $expected, string $dsn): void + public function testSupports(bool $expected, string $dsn) { $factory = $this->createFactory(); @@ -65,7 +65,7 @@ abstract class TransportFactoryTestCase extends TestCase /** * @dataProvider createProvider */ - public function testCreate(string $expected, string $dsn): void + public function testCreate(string $expected, string $dsn) { $factory = $this->createFactory(); $transport = $factory->create(Dsn::fromString($dsn)); @@ -76,7 +76,7 @@ abstract class TransportFactoryTestCase extends TestCase /** * @dataProvider unsupportedSchemeProvider */ - public function testUnsupportedSchemeException(string $dsn, string $message = null): void + public function testUnsupportedSchemeException(string $dsn, string $message = null) { $factory = $this->createFactory(); @@ -93,7 +93,7 @@ abstract class TransportFactoryTestCase extends TestCase /** * @dataProvider incompleteDsnProvider */ - public function testIncompleteDsnException(string $dsn, string $message = null): void + public function testIncompleteDsnException(string $dsn, string $message = null) { $factory = $this->createFactory(); diff --git a/src/Symfony/Component/Notifier/Tests/TransportTestCase.php b/src/Symfony/Component/Notifier/Tests/TransportTestCase.php index d55d5b670f..18f2d40d3a 100644 --- a/src/Symfony/Component/Notifier/Tests/TransportTestCase.php +++ b/src/Symfony/Component/Notifier/Tests/TransportTestCase.php @@ -47,7 +47,7 @@ abstract class TransportTestCase extends TestCase /** * @dataProvider toStringProvider */ - public function testToString(string $expected, TransportInterface $transport): void + public function testToString(string $expected, TransportInterface $transport) { $this->assertSame($expected, (string) $transport); } @@ -55,7 +55,7 @@ abstract class TransportTestCase extends TestCase /** * @dataProvider supportedMessagesProvider */ - public function testSupportedMessages(MessageInterface $message, ?TransportInterface $transport = null): void + public function testSupportedMessages(MessageInterface $message, ?TransportInterface $transport = null) { if (null === $transport) { $transport = $this->createTransport(); @@ -67,7 +67,7 @@ abstract class TransportTestCase extends TestCase /** * @dataProvider unsupportedMessagesProvider */ - public function testUnsupportedMessages(MessageInterface $message, ?TransportInterface $transport = null): void + public function testUnsupportedMessages(MessageInterface $message, ?TransportInterface $transport = null) { if (null === $transport) { $transport = $this->createTransport(); @@ -79,7 +79,7 @@ abstract class TransportTestCase extends TestCase /** * @dataProvider unsupportedMessagesProvider */ - public function testUnsupportedMessagesTrowLogicExceptionWhenSend(MessageInterface $message, ?TransportInterface $transport = null): void + public function testUnsupportedMessagesTrowLogicExceptionWhenSend(MessageInterface $message, ?TransportInterface $transport = null) { if (null === $transport) { $transport = $this->createTransport(); @@ -90,7 +90,7 @@ abstract class TransportTestCase extends TestCase $transport->send($message); } - public function testCanSetCustomHost(): void + public function testCanSetCustomHost() { $transport = $this->createTransport(); @@ -99,7 +99,7 @@ abstract class TransportTestCase extends TestCase $this->assertStringContainsString(sprintf('://%s', $customHost), (string) $transport); } - public function testCanSetCustomPort(): void + public function testCanSetCustomPort() { $transport = $this->createTransport(); @@ -111,7 +111,7 @@ abstract class TransportTestCase extends TestCase $this->assertMatchesRegularExpression(sprintf('/^.*\/\/.*\:%s.*$/', $customPort), (string) $transport); } - public function testCanSetCustomHostAndPort(): void + public function testCanSetCustomHostAndPort() { $transport = $this->createTransport(); diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ConstructorExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ConstructorExtractorTest.php index 7c3631db27..c26c1b24b9 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ConstructorExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ConstructorExtractorTest.php @@ -41,7 +41,7 @@ class ConstructorExtractorTest extends TestCase $this->assertEquals([new Type(Type::BUILTIN_TYPE_STRING)], $this->extractor->getTypes('Foo', 'bar', [])); } - public function testGetTypes_ifNoExtractors() + public function testGetTypesIfNoExtractors() { $extractor = new ConstructorExtractor([]); $this->assertNull($extractor->getTypes('Foo', 'bar', [])); diff --git a/src/Symfony/Component/PropertyInfo/Util/PhpDocTypeHelper.php b/src/Symfony/Component/PropertyInfo/Util/PhpDocTypeHelper.php index 8744a33ce7..381f801275 100644 --- a/src/Symfony/Component/PropertyInfo/Util/PhpDocTypeHelper.php +++ b/src/Symfony/Component/PropertyInfo/Util/PhpDocTypeHelper.php @@ -122,7 +122,7 @@ final class PhpDocTypeHelper $collectionKeyType = $this->getTypes($type->getKeyType())[0]; $collectionValueTypes = $this->getTypes($type->getValueType()); - if (\count($collectionValueTypes) != 1) { + if (1 != \count($collectionValueTypes)) { // the Type class does not support union types yet, so assume that no type was defined $collectionValueType = null; } else { diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php index 2802fac484..cccb28743f 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php @@ -156,7 +156,7 @@ class AuthenticatorManagerTest extends TestCase yield [false]; } - public function testAuthenticateRequestCanModifyTokenFromEvent(): void + public function testAuthenticateRequestCanModifyTokenFromEvent() { $authenticator = $this->createAuthenticator(); $this->request->attributes->set('_security_authenticators', [$authenticator]); @@ -191,7 +191,7 @@ class AuthenticatorManagerTest extends TestCase $manager->authenticateUser($this->user, $authenticator, $this->request); } - public function testAuthenticateUserCanModifyTokenFromEvent(): void + public function testAuthenticateUserCanModifyTokenFromEvent() { $authenticator = $this->createAuthenticator(); $authenticator->expects($this->any())->method('createAuthenticatedToken')->willReturn($this->token); diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryCompilerTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryCompilerTest.php index 2ce24718df..af628eb772 100644 --- a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryCompilerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryCompilerTest.php @@ -7,9 +7,9 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryCompiler; use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; -use Symfony\Component\Serializer\Tests\Fixtures\Dummy; use Symfony\Component\Serializer\Tests\Fixtures\Annotations\MaxDepthDummy; use Symfony\Component\Serializer\Tests\Fixtures\Annotations\SerializedNameDummy; +use Symfony\Component\Serializer\Tests\Fixtures\Dummy; final class ClassMetadataFactoryCompilerTest extends TestCase { diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CompiledClassMetadataFactoryTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CompiledClassMetadataFactoryTest.php index 034e8aa088..06ea7c7e86 100644 --- a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CompiledClassMetadataFactoryTest.php +++ b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CompiledClassMetadataFactoryTest.php @@ -7,8 +7,8 @@ use Symfony\Component\Serializer\Mapping\AttributeMetadata; use Symfony\Component\Serializer\Mapping\ClassMetadata; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; use Symfony\Component\Serializer\Mapping\Factory\CompiledClassMetadataFactory; -use Symfony\Component\Serializer\Tests\Fixtures\Dummy; use Symfony\Component\Serializer\Tests\Fixtures\Annotations\SerializedNameDummy; +use Symfony\Component\Serializer\Tests\Fixtures\Dummy; /** * @author Fabien Bourigault diff --git a/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php b/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php index ba20bc7b0d..250f6be40e 100644 --- a/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php +++ b/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php @@ -18,8 +18,8 @@ use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; -use Symfony\Component\Serializer\Tests\Fixtures\OtherSerializedNameDummy; use Symfony\Component\Serializer\Tests\Fixtures\Annotations\SerializedNameDummy; +use Symfony\Component\Serializer\Tests\Fixtures\OtherSerializedNameDummy; /** * @author Fabien Bourigault diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php index 3aa4d1c63d..1985911ea6 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php @@ -14,8 +14,8 @@ use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; use Symfony\Component\Serializer\Normalizer\PropertyNormalizer; use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\Tests\Fixtures\AbstractNormalizerDummy; -use Symfony\Component\Serializer\Tests\Fixtures\Dummy; use Symfony\Component\Serializer\Tests\Fixtures\Annotations\IgnoreDummy; +use Symfony\Component\Serializer\Tests\Fixtures\Dummy; use Symfony\Component\Serializer\Tests\Fixtures\NullableConstructorArgumentDummy; use Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorDummy; use Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorNormalizer; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index b2efafc348..c16bf1ee1f 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -27,8 +27,8 @@ use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\SerializerInterface; -use Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy; use Symfony\Component\Serializer\Tests\Fixtures\Annotations\GroupDummy; +use Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy; use Symfony\Component\Serializer\Tests\Fixtures\SiblingHolder; use Symfony\Component\Serializer\Tests\Normalizer\Features\CallbacksTestTrait; use Symfony\Component\Serializer\Tests\Normalizer\Features\CircularReferenceTestTrait; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php index 67989d200e..663eacc3ef 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php @@ -25,9 +25,9 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\PropertyNormalizer; use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\SerializerInterface; -use Symfony\Component\Serializer\Tests\Fixtures\Dummy; use Symfony\Component\Serializer\Tests\Fixtures\Annotations\GroupDummy; use Symfony\Component\Serializer\Tests\Fixtures\Annotations\GroupDummyChild; +use Symfony\Component\Serializer\Tests\Fixtures\Dummy; use Symfony\Component\Serializer\Tests\Fixtures\Php74Dummy; use Symfony\Component\Serializer\Tests\Fixtures\PropertyCircularReferenceDummy; use Symfony\Component\Serializer\Tests\Fixtures\PropertySiblingHolder; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/UidNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/UidNormalizerTest.php index 172c328a5e..44a7217e0a 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/UidNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/UidNormalizerTest.php @@ -3,7 +3,6 @@ namespace Symfony\Component\Serializer\Tests\Normalizer; use PHPUnit\Framework\TestCase; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\UidNormalizer; use Symfony\Component\Uid\AbstractUid; use Symfony\Component\Uid\Ulid; diff --git a/src/Symfony/Component/Translation/Tests/PseudoLocalizationTranslatorTest.php b/src/Symfony/Component/Translation/Tests/PseudoLocalizationTranslatorTest.php index b63e3da2db..895586fde7 100644 --- a/src/Symfony/Component/Translation/Tests/PseudoLocalizationTranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/PseudoLocalizationTranslatorTest.php @@ -20,7 +20,7 @@ final class PseudoLocalizationTranslatorTest extends TestCase /** * @dataProvider provideTrans */ - public function testTrans(string $expected, string $input, array $options = []): void + public function testTrans(string $expected, string $input, array $options = []) { mt_srand(987); $this->assertSame($expected, (new PseudoLocalizationTranslator(new IdentityTranslator(), $options))->trans($input)); @@ -50,7 +50,7 @@ final class PseudoLocalizationTranslatorTest extends TestCase /** * @dataProvider provideInvalidExpansionFactor */ - public function testInvalidExpansionFactor(float $expansionFactor): void + public function testInvalidExpansionFactor(float $expansionFactor) { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('The expansion factor must be greater than or equal to 1.'); diff --git a/src/Symfony/Component/Validator/Constraints/Regex.php b/src/Symfony/Component/Validator/Constraints/Regex.php index fbe2485b43..35a1806039 100644 --- a/src/Symfony/Component/Validator/Constraints/Regex.php +++ b/src/Symfony/Component/Validator/Constraints/Regex.php @@ -38,7 +38,7 @@ class Regex extends Constraint /** * {@inheritdoc} * - * @param string|array $pattern The pattern to evaluate or an array of options. + * @param string|array $pattern The pattern to evaluate or an array of options */ public function __construct( $pattern, diff --git a/src/Symfony/Component/Validator/Constraints/Timezone.php b/src/Symfony/Component/Validator/Constraints/Timezone.php index bdc3ee582e..409fbc1d12 100644 --- a/src/Symfony/Component/Validator/Constraints/Timezone.php +++ b/src/Symfony/Component/Validator/Constraints/Timezone.php @@ -44,7 +44,7 @@ class Timezone extends Constraint /** * {@inheritdoc} * - * @param int|array|null $zone A combination of {@see \DateTimeZone} class constants or a set of options. + * @param int|array|null $zone A combination of {@see \DateTimeZone} class constants or a set of options */ public function __construct( $zone = null, diff --git a/src/Symfony/Component/Validator/Constraints/Type.php b/src/Symfony/Component/Validator/Constraints/Type.php index 95e1c61e02..220c2191a3 100644 --- a/src/Symfony/Component/Validator/Constraints/Type.php +++ b/src/Symfony/Component/Validator/Constraints/Type.php @@ -34,7 +34,7 @@ class Type extends Constraint /** * {@inheritdoc} * - * @param string|array $type One ore multiple types to validate against or a set of options. + * @param string|array $type One ore multiple types to validate against or a set of options */ public function __construct($type, string $message = null, array $groups = null, $payload = null, array $options = []) { diff --git a/src/Symfony/Component/Validator/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Validator/Tests/Command/DebugCommandTest.php index 676b28d93f..0f2b7b17f6 100644 --- a/src/Symfony/Component/Validator/Tests/Command/DebugCommandTest.php +++ b/src/Symfony/Component/Validator/Tests/Command/DebugCommandTest.php @@ -26,7 +26,7 @@ use Symfony\Component\Validator\Tests\Dummy\DummyClassOne; */ class DebugCommandTest extends TestCase { - public function testOutputWithClassArgument(): void + public function testOutputWithClassArgument() { $validator = $this->createMock(MetadataFactoryInterface::class); $classMetadata = $this->createMock(ClassMetadataInterface::class); @@ -90,7 +90,7 @@ TXT ); } - public function testOutputWithPathArgument(): void + public function testOutputWithPathArgument() { $validator = $this->createMock(MetadataFactoryInterface::class); $classMetadata = $this->createMock(ClassMetadataInterface::class); @@ -171,7 +171,7 @@ TXT ); } - public function testOutputWithInvalidClassArgument(): void + public function testOutputWithInvalidClassArgument() { $validator = $this->createMock(MetadataFactoryInterface::class); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php index c0e62f7b23..d17d597e72 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php @@ -161,7 +161,6 @@ class LanguageValidatorTest extends ConstraintValidatorTestCase eval('return new \Symfony\Component\Validator\Constraints\Language(alpha3: true, message: "myMessage");') ); - $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"DE"') ->setCode(Language::NO_SUCH_LANGUAGE_ERROR) diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintChoiceWithPreset.php b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintChoiceWithPreset.php index 9e0cc37e23..e4154e8c8d 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintChoiceWithPreset.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintChoiceWithPreset.php @@ -17,10 +17,11 @@ class ConstraintChoiceWithPreset extends Choice { public $type; - public function __construct(string $type) { + public function __construct(string $type) + { parent::__construct($type); - if ($this->type === 'A') { + if ('A' === $this->type) { $this->choices = ['A', 'B', 'C']; } else { $this->choices = ['D', 'E', 'F'];