mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #1314 - make sure we always know what a closure is if we’re using one
This commit is contained in:
parent
c58100e3af
commit
9a8f969d5c
@ -245,6 +245,10 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
|||||||
} elseif ($node instanceof PhpParser\Node\FunctionLike) {
|
} elseif ($node instanceof PhpParser\Node\FunctionLike) {
|
||||||
$this->registerFunctionLike($node);
|
$this->registerFunctionLike($node);
|
||||||
|
|
||||||
|
if ($node instanceof PhpParser\Node\Expr\Closure) {
|
||||||
|
$this->codebase->scanner->queueClassLikeForScanning('Closure', $this->file_path);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->scan_deep) {
|
if (!$this->scan_deep) {
|
||||||
return PhpParser\NodeTraverser::DONT_TRAVERSE_CHILDREN;
|
return PhpParser\NodeTraverser::DONT_TRAVERSE_CHILDREN;
|
||||||
}
|
}
|
||||||
|
@ -1198,7 +1198,12 @@ class TypeReconciliationTest extends TestCase
|
|||||||
$s = rand(0,1) ? "strlen" : [1];
|
$s = rand(0,1) ? "strlen" : [1];
|
||||||
if (!is_callable($s)) {
|
if (!is_callable($s)) {
|
||||||
array_pop($s);
|
array_pop($s);
|
||||||
}'
|
}
|
||||||
|
|
||||||
|
$a = rand(0, 1) ? (function(): void {}) : 1.1;
|
||||||
|
if (!is_callable($a)) {
|
||||||
|
echo $a;
|
||||||
|
}',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user