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

Fix a possibly undefined variable seen when issue is suppressed (#391)

This commit is contained in:
Tyson Andre 2017-12-15 09:07:34 -08:00 committed by Matthew Brown
parent 8590b2b9b4
commit e2e86beee7

View File

@ -182,20 +182,19 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
$this->classlike_storages[] = $storage; $this->classlike_storages[] = $storage;
if ($doc_comment) { if ($doc_comment) {
$docblock_info = null;
try { try {
$docblock_info = CommentChecker::extractClassLikeDocblockInfo( $docblock_info = CommentChecker::extractClassLikeDocblockInfo(
(string)$doc_comment, (string)$doc_comment,
$doc_comment->getLine() $doc_comment->getLine()
); );
} catch (DocblockParseException $e) { } catch (DocblockParseException $e) {
if (IssueBuffer::accepts( IssueBuffer::accepts(
new InvalidDocblock( new InvalidDocblock(
$e->getMessage() . ' in docblock for ' . implode('.', $this->fq_classlike_names), $e->getMessage() . ' in docblock for ' . implode('.', $this->fq_classlike_names),
new CodeLocation($this->file_checker, $node, null, true) new CodeLocation($this->file_checker, $node, null, true)
) )
)) { );
$docblock_info = null;
}
} }
if ($docblock_info) { if ($docblock_info) {