Open
Description
Symfony version(s) affected
7.3.0
Description
I'm trying to upgrade from Symfony 6.4 to 7.3, but the Serializer is failing to recognize nested Types. Upon deeper inspection it turned out that the TypeContextFactory::collectUses
is gathering values with ;
.
Im running on WSL with PHP 8.4.8. I've cloned the Property Info Component and uppon running
php vendor/bin/phpunit --filter testCollectUses Tests/TypeContext/TypeContextFactoryTest.php
I'm getting the following failure:
1) Symfony\Component\TypeInfo\Tests\TypeContext\TypeContextFactoryTest::testCollectUses
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
Array &0 [
- 'Type' => 'Symfony\Component\TypeInfo\Type',
- 'DateTimeInterface' => '\DateTimeInterface',
- 'DateTime' => '\DateTimeImmutable',
+ 'Type;' => 'Symfony\Component\TypeInfo\Type;',
+ 'DateTimeInterface;' => '\DateTimeInterface;',
+ 'DateTime;' => '\DateTimeImmutable',
]
/home/exsio/dev/type-info/Tests/TypeContext/TypeContextFactoryTest.php:83
FAILURES!
Tests: 1, Assertions: 2, Failures: 1, PHPUnit Deprecations: 1.
This is a complete migration blocker for me.
How to reproduce
- Install PHP 8.4.8
- Run
php vendor/bin/phpunit --filter testCollectUses Tests/TypeContext/TypeContextFactoryTest.php
This may be failing only on WSL, not sure about native distro.
Possible Solution
Modify TypeContextFactory
on line 139
and replace
$uses[$alias] = $use[0];
with
$uses[str_replace(";","", $alias)] = str_replace(";","", $use[0]);
Additional Context
No response