1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix crash with @var over echo

This commit is contained in:
Brown 2020-09-01 00:12:12 -04:00 committed by Daniil Gentili
parent 8611f99e09
commit 472c2839ad
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 6 additions and 0 deletions

View File

@ -451,6 +451,7 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|| $node instanceof PhpParser\Node\Stmt\Foreach_
|| $node instanceof PhpParser\Node\Stmt\While_
|| $node instanceof PhpParser\Node\Stmt\Do_
|| $node instanceof PhpParser\Node\Stmt\Echo_
) {
if ($doc_comment = $node->getDocComment()) {
$var_comments = [];

View File

@ -1168,6 +1168,11 @@ class AnnotationTest extends TestCase
function takesString(string $s): void {}'
],
'noCrashWithoutAssignment' => [
'<?php
/** @var DateTime $obj */
echo $obj->format("Y");'
],
];
}