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
Description
AnUndefined 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 */publicfunctionsetData($data) { }}
Variable$extractor
is an instance ofSymfony\Component\PropertyInfo\Extractor\PhpStanExtractor
$extractor->getType(InvalidDummy::class,'data');
Possible Solution
Update methodgetType
inPhpStanExtractor
to add a check onTypelessParamTagValueNode
if ($tagDocNode->valueinstanceof InvalidTagValueNode ||$tagDocNode->valueinstanceof TypelessParamTagValueNode) {continue;}if ($tagDocNode->valueinstanceof ParamTagValueNode &&null ===$prefix &&$tagDocNode->value->parameterName !=='$'.$property) {continue;}try {$types[] =$this->stringTypeResolver->resolve((string)$tagDocNode->value->type,$typeContext);}catch (UnsupportedException) {}
Additional Context
No response