Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Closed
Description
Symfony version(s) affected
7.2.4
Description
The@var
tag is no longer read for promoted properties.
The bug was introduced in#59681
The example in the documentation no longer works:https://symfony.com/doc/current/components/type_info.html#phpdoc-parsing
How to reproduce
class Dummy{publicfunction__construct(/** @var list<string> $tags */publicarray$tags, ) { }}$typeResolver = TypeResolver::create();var_export($typeResolver->resolve(new \ReflectionProperty(Dummy::class,'tags')));// only "array" instead of "list<string>"
Possible Solution
The correct solution is to prioritize the@var
annotation on the property and then fallback to the@param
annotation on the constructor
Additional Context
No response