From ff1396754583418ae18dfa27a30231e2359dd751 Mon Sep 17 00:00:00 2001 From: Samuele Lilli Date: Fri, 8 Jan 2021 08:54:08 +0100 Subject: [PATCH 1/3] Switched from parent type hard-coded FQCN to `::class` keyword. --- src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php | 3 ++- src/Symfony/Component/Form/AbstractType.php | 3 ++- src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index 4ff2e508c1..3a77e74c56 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -22,6 +22,7 @@ use Symfony\Bridge\Doctrine\Form\EventListener\MergeDoctrineCollectionListener; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator; use Symfony\Component\Form\Exception\RuntimeException; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -274,7 +275,7 @@ abstract class DoctrineType extends AbstractType implements ResetInterface public function getParent() { - return 'Symfony\Component\Form\Extension\Core\Type\ChoiceType'; + return ChoiceType::class; } public function reset() diff --git a/src/Symfony/Component/Form/AbstractType.php b/src/Symfony/Component/Form/AbstractType.php index be3c87d9ca..3325b8bc27 100644 --- a/src/Symfony/Component/Form/AbstractType.php +++ b/src/Symfony/Component/Form/AbstractType.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Form; +use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Util\StringUtil; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -60,6 +61,6 @@ abstract class AbstractType implements FormTypeInterface */ public function getParent() { - return 'Symfony\Component\Form\Extension\Core\Type\FormType'; + return FormType::class; } } diff --git a/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php b/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php index ceb25f5559..5058bf6a6f 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\Tests\Fixtures; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -38,6 +39,6 @@ class ChoiceSubType extends AbstractType */ public function getParent(): ?string { - return 'Symfony\Component\Form\Extension\Core\Type\ChoiceType'; + return ChoiceType::class; } } From 0028efe8f88d243a96de5a93f0e4942c5da29d42 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 9 Jan 2021 13:36:14 +0100 Subject: [PATCH 2/3] quote all dumped unicode spaces --- src/Symfony/Component/Yaml/Escaper.php | 2 +- src/Symfony/Component/Yaml/Tests/DumperTest.php | 15 +++++++++++++++ src/Symfony/Component/Yaml/Tests/InlineTest.php | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Yaml/Escaper.php b/src/Symfony/Component/Yaml/Escaper.php index 150c5f6dad..78d93ddfe3 100644 --- a/src/Symfony/Component/Yaml/Escaper.php +++ b/src/Symfony/Component/Yaml/Escaper.php @@ -86,7 +86,7 @@ class Escaper // Determines if the PHP value contains any single characters that would // cause it to require single quoting in YAML. - return 0 < preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value); + return 0 < preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` \p{Zs}]/xu', $value); } /** diff --git a/src/Symfony/Component/Yaml/Tests/DumperTest.php b/src/Symfony/Component/Yaml/Tests/DumperTest.php index 5bf0530220..41c8b02c7b 100644 --- a/src/Symfony/Component/Yaml/Tests/DumperTest.php +++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php @@ -635,6 +635,21 @@ YAML; { $this->assertSame('{ foo: ~ }', $this->dumper->dump(['foo' => null], 0, 0, Yaml::DUMP_NULL_AS_TILDE)); } + + public function testDumpIdeographicSpaces() + { + $expected = <<assertSame($expected, $this->dumper->dump([ + 'alone' => ' ', + 'within_string' => 'a b', + 'regular_space' => 'a b', + ], 2)); + } } class A diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index b4143b9c17..0f608c330c 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -511,6 +511,10 @@ class InlineTest extends TestCase ['"0123\r"', "0123\r"], ['"0123\t"', "0123\t"], ['"0123\v"', "0123\v"], + + // whitespaces + 'ideographic space' => ["' '", ' '], + 'ideographic space surrounded by characters' => ["'a b'", 'a b'], ]; } From 1ec5a65c73fb7095f41a02b9d4e1b54b60528c2f Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sun, 10 Jan 2021 16:19:05 +0100 Subject: [PATCH 3/3] Remove "requires PHP 7.2" annotations --- .../Tests/Compiler/CheckTypeDeclarationsPassTest.php | 3 --- .../Tests/DependencyInjection/RegisterListenersPassTest.php | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php index 058a9f6298..692fbf84cd 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php @@ -399,9 +399,6 @@ class CheckTypeDeclarationsPassTest extends TestCase $this->addToAssertionCount(1); } - /** - * @requires PHP 7.2 - */ public function testProcessSuccessWhenPassingDefinitionForObjectType() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php index a0b94dbc44..da28110516 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php @@ -331,9 +331,6 @@ class RegisterListenersPassTest extends TestCase $registerListenersPass->process($container); } - /** - * @requires PHP 7.2 - */ public function testOmitEventNameAndMethodOnGenericListener() { $container = new ContainerBuilder();