Closed
Description
Symfony version(s) affected
7.2
Description
An Undefined property
error is issued when a @param
annotation has a name without typing (PhpStanExtractor context).
Undefined property: PHPStan\PhpDocParser\Ast\PhpDoc\TypelessParamTagValueNode::$type
src/Symfony/Component/PropertyInfo/Extractor/PhpStanExtractor.php:219
How to reproduce
class InvalidDummy
{
/**
* @param $data
*/
public function setData($data)
{
}
}
Variable $extractor
is an instance of Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor
$extractor->getType(InvalidDummy::class, 'data');
Possible Solution
Update method getType
in PhpStanExtractor
to add a check on TypelessParamTagValueNode
if ($tagDocNode->value instanceof InvalidTagValueNode || $tagDocNode->value instanceof TypelessParamTagValueNode) {
continue;
}
if ($tagDocNode->value instanceof ParamTagValueNode && null === $prefix && $tagDocNode->value->parameterName !== '$'.$property) {
continue;
}
try {
$types[] = $this->stringTypeResolver->resolve((string) $tagDocNode->value->type, $typeContext);
} catch (UnsupportedException) {
}
Additional Context
No response