Skip to content

Commit 25f531b

Browse files
minor #62731 [PropertyInfo] keep test with Type class from TypeInfo component (xabbuh)
This PR was merged into the 7.3 branch. Discussion ---------- [PropertyInfo] keep test with Type class from TypeInfo component | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT fixes the upmerge of #62717 Commits ------- aa06445 keep test with Type class from TypeInfo component
2 parents 23852a5 + aa06445 commit 25f531b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\PropertyInfo\Tests\Fixtures\Clazz;
1919
use Symfony\Component\PropertyInfo\Tests\Fixtures\ConstructorDummy;
2020
use Symfony\Component\PropertyInfo\Tests\Fixtures\ConstructorDummyWithoutDocBlock;
21+
use Symfony\Component\PropertyInfo\Tests\Fixtures\ConstructorDummyWithVarTagsDocBlock;
2122
use Symfony\Component\PropertyInfo\Tests\Fixtures\DefaultValue;
2223
use Symfony\Component\PropertyInfo\Tests\Fixtures\DockBlockFallback;
2324
use Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy;
@@ -967,6 +968,27 @@ public static function constructorTypesProvider(): iterable
967968
yield ['ddd', null];
968969
}
969970

971+
/**
972+
* @dataProvider provideConstructorTypesWithOnlyVarTags
973+
*/
974+
public function testExtractConstructorTypesWithOnlyVarTags(string $property, ?Type $type)
975+
{
976+
$this->assertEquals($type, $this->extractor->getTypeFromConstructor(ConstructorDummyWithVarTagsDocBlock::class, $property));
977+
}
978+
979+
/**
980+
* @return iterable<array{0: string, 1: ?Type}>
981+
*/
982+
public static function provideConstructorTypesWithOnlyVarTags(): iterable
983+
{
984+
yield ['date', Type::int()];
985+
yield ['dateObject', Type::object(\DateTimeInterface::class)];
986+
yield ['objectsArray', Type::array(Type::object(ConstructorDummy::class))];
987+
yield ['dateTime', null];
988+
yield ['mixed', null];
989+
yield ['timezone', null];
990+
}
991+
970992
/**
971993
* @dataProvider constructorTypesOfParentClassProvider
972994
*/

0 commit comments

Comments
 (0)