Skip to content

Commit 03c2c66

Browse files
mtarldKorbeil
andcommitted
[PropertyInfo] Deprecate PropertyInfo Type
Co-authored-by: Baptiste Leduc <[email protected]>
1 parent 65bad76 commit 03c2c66

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

Tests/Functional/PropertyInfoTest.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,38 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
1313

14-
use Symfony\Component\PropertyInfo\Type;
14+
use Symfony\Component\PropertyInfo\Type as LegacyType;
15+
use Symfony\Component\TypeInfo\Type;
1516

1617
class PropertyInfoTest extends AbstractWebTestCase
1718
{
1819
public function testPhpDocPriority()
1920
{
2021
static::bootKernel(['test_case' => 'Serializer']);
2122

22-
$this->assertEquals([new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_INT))], static::getContainer()->get('property_info')->getTypes('Symfony\Bundle\FrameworkBundle\Tests\Functional\Dummy', 'codes'));
23+
$propertyInfo = static::getContainer()->get('property_info');
24+
25+
if (!method_exists($propertyInfo, 'getType')) {
26+
$this->markTestSkipped();
27+
}
28+
29+
$this->assertEquals(Type::list(Type::int()), $propertyInfo->getType(Dummy::class, 'codes'));
30+
}
31+
32+
/**
33+
* @group legacy
34+
*/
35+
public function testPhpDocPriorityLegacy()
36+
{
37+
static::bootKernel(['test_case' => 'Serializer']);
38+
39+
$propertyInfo = static::getContainer()->get('property_info');
40+
41+
if (!method_exists($propertyInfo, 'getTypes')) {
42+
$this->markTestSkipped();
43+
}
44+
45+
$this->assertEquals([new LegacyType('array', false, null, true, new LegacyType('int'), new LegacyType('int'))], $propertyInfo->getTypes(Dummy::class, 'codes'));
2346
}
2447
}
2548

0 commit comments

Comments
 (0)