Skip to content

Commit 5a3570d

Browse files
committed
feature #53160 [PropertyInfo] Deprecate PropertyInfo Type (mtarld)
This PR was merged into the 7.1 branch. Discussion ---------- [PropertyInfo] Deprecate PropertyInfo Type | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | yes | Issues | | License | MIT This PR is a follow-up of symfony/symfony#52510. As the TypeInfo's `Type` aims to represent types in the Symfony ecosystem, the PropertyInfo's `Type` needs to be deprecated in favor of the first one. Commits ------- d32e81c816 [PropertyInfo] Deprecate PropertyInfo Type
2 parents 601ff99 + 03c2c66 commit 5a3570d

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

Tests/Functional/PropertyInfoTest.php

+25-2
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)