You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New property_info fallback introduced in 4.3.6 causes a bug in configuration loading #8201
After upgrading from 4.3.5 to 4.3.6, bin/console cache:clear on a sylius standard project crashes with:
Cannot create union with both "object" and class type
This regression was introduced by PR #7969, which changed api_platform.property_info from a simple alias to Symfony's property_info service into a standalone PropertyInfoExtractor that registers its own PhpStanExtractor tagged with property_info.type_extractor.
How to reproduce
Use a Symfony full-stack application with API Platform and any entities that extend Doctrine interfaces annotated with @template T of object (in my case, I'm in a Sylius-based project, but any project using doctrine/persistence or doctrine/common is likely affected)
Upgrade API Platform from 4.3.5 to 4.3.6
Run bin/console cache:clear
Relevant part of the stacktrace:
[Symfony\Component\TypeInfo\Exception\InvalidArgumentException]
Cannot create union with both "object" and class type.
at UnionType.php:75
Symfony\Component\TypeInfo\Type::union() at TypeFactoryTrait.php:330
Symfony\Component\TypeInfo\TypeResolver\StringTypeResolver->getTypeFromNode() at StringTypeResolver.php:318
Symfony\Component\TypeInfo\TypeResolver\StringTypeResolver->resolve() at StringTypeResolver.php:95
Symfony\Component\TypeInfo\TypeContext\TypeContextFactory->collectTemplates() at TypeContextFactory.php:254
Symfony\Component\TypeInfo\TypeContext\TypeContextFactory->createFromClassName() at TypeContextFactory.php:71
Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor->getType() at PhpStanExtractor.php:209
...
ApiPlatform\Symfony\Validator\Metadata\Property\ValidatorPropertyMetadataFactory->create() at ValidatorPropertyMetadataFactory.php:102
ApiPlatform\Symfony\Routing\ApiLoader->load() at ApiLoader.php:70
Possible Solution
I'm not sure, but IMO, registering api_platform.property_info.phpstan_extractor with the global property_info.type_extractor tag causes it to be injected into all PropertyInfoExtractor instances in the
container, including those used by Symfony's validator.
You might consider either scoping this service so it is only consumed by api_platform.property_info ?
Additional Context
None.
Reacted by Nina Alin, Laurent PICHON, Anthony Leroux, Axel SERRIE and Antoine Bluchet
Activity
fix(symfony): isolate api_platform.property_info tags
fix(symfony): isolate api_platform.property_info tags (#8206)
soyuka commentedon May 29, 2026
Thanks for the report indeed it's a mis behavior, it should be fixed properly by now and released as 4.3.7. Let me know if you have another issue.
tmartin commentedon May 29, 2026
Thank you for the lightning fast fix on this! 🙏