-
-
Notifications
You must be signed in to change notification settings - Fork 9.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
{
public function __construct(
/** @var list<string> $tags */
public array $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