Merge branch '5.1' into 5.2

* 5.1:
  Remove "requires PHP 7.2" annotations
  quote all dumped unicode spaces
  Switched from parent type hard-coded FQCN to `::class` keyword.
This commit is contained in:
Fabien Potencier 2021-01-10 17:26:11 +01:00
commit ff3c37dc10
8 changed files with 26 additions and 10 deletions

View File

@ -23,6 +23,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\ChoiceList\ChoiceList;
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;
@ -239,7 +240,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()

View File

@ -399,9 +399,6 @@ class CheckTypeDeclarationsPassTest extends TestCase
$this->addToAssertionCount(1);
}
/**
* @requires PHP 7.2
*/
public function testProcessSuccessWhenPassingDefinitionForObjectType()
{
$container = new ContainerBuilder();

View File

@ -331,9 +331,6 @@ class RegisterListenersPassTest extends TestCase
$registerListenersPass->process($container);
}
/**
* @requires PHP 7.2
*/
public function testOmitEventNameAndMethodOnGenericListener()
{
$container = new ContainerBuilder();

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
/**

View File

@ -635,6 +635,21 @@ YAML;
{
$this->assertSame('{ foo: ~ }', $this->dumper->dump(['foo' => null], 0, 0, Yaml::DUMP_NULL_AS_TILDE));
}
public function testDumpIdeographicSpaces()
{
$expected = <<<YAML
alone: ' '
within_string: 'a b'
regular_space: 'a b'
YAML;
$this->assertSame($expected, $this->dumper->dump([
'alone' => ' ',
'within_string' => 'a b',
'regular_space' => 'a b',
], 2));
}
}
class A

View File

@ -514,6 +514,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'],
];
}