1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Fix #1026 - warn about bad docblock in @property annotation

This commit is contained in:
Matthew Brown 2018-11-01 23:04:00 -04:00
parent b1c704da4d
commit 1152aa953f

View File

@ -686,15 +686,27 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
$this->type_aliases
);
$pseudo_property_type = Type::parseTokens($pseudo_property_type_tokens);
$pseudo_property_type->setFromDocblock();
try {
$pseudo_property_type = Type::parseTokens($pseudo_property_type_tokens);
$pseudo_property_type->setFromDocblock();
if ($property['tag'] !== 'property-read') {
$storage->pseudo_property_set_types[$property['name']] = $pseudo_property_type;
}
if ($property['tag'] !== 'property-read') {
$storage->pseudo_property_set_types[$property['name']] = $pseudo_property_type;
}
if ($property['tag'] !== 'property-write') {
$storage->pseudo_property_get_types[$property['name']] = $pseudo_property_type;
if ($property['tag'] !== 'property-write') {
$storage->pseudo_property_get_types[$property['name']] = $pseudo_property_type;
}
} catch (TypeParseTreeException $e) {
if (IssueBuffer::accepts(
new InvalidDocblock(
$e->getMessage() . ' in docblock for ' . implode('.', $this->fq_classlike_names),
new CodeLocation($this->file_scanner, $node, null, true)
)
)) {
}
$storage->has_docblock_issues = true;
}
}
}