From 723cd0919d69b04b8cec823c0afe09736eaf0e8e Mon Sep 17 00:00:00 2001 From: Emil Masiakowski Date: Fri, 11 Mar 2022 18:25:39 +0100 Subject: [PATCH] [PropertyInfo] strip only leading `\` when unknown docType --- .../Tests/Extractor/PhpDocExtractorTest.php | 6 ++++++ .../PropertyInfo/Tests/Fixtures/PseudoTypeDummy.php | 11 +++++++++++ .../Component/PropertyInfo/Util/PhpDocTypeHelper.php | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/PropertyInfo/Tests/Fixtures/PseudoTypeDummy.php diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php index 4a141642d0009..5737fb02cd5ef 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php @@ -18,6 +18,7 @@ use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; use Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy; use Symfony\Component\PropertyInfo\Tests\Fixtures\ParentDummy; +use Symfony\Component\PropertyInfo\Tests\Fixtures\PseudoTypeDummy; use Symfony\Component\PropertyInfo\Tests\Fixtures\TraitUsage\DummyUsedInTrait; use Symfony\Component\PropertyInfo\Tests\Fixtures\TraitUsage\DummyUsingTrait; use Symfony\Component\PropertyInfo\Type; @@ -350,6 +351,11 @@ public function propertiesParentTypeProvider(): array ]; } + public function testUnknownPseudoType() + { + $this->assertEquals([new Type(Type::BUILTIN_TYPE_OBJECT, false, 'scalar')], $this->extractor->getTypes(PseudoTypeDummy::class, 'unknownPseudoType')); + } + protected function isPhpDocumentorV5() { if (class_exists(InvalidTag::class)) { diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/PseudoTypeDummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/PseudoTypeDummy.php new file mode 100644 index 0000000000000..71756044fafc9 --- /dev/null +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/PseudoTypeDummy.php @@ -0,0 +1,11 @@ +