mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Check uses before checking functions
This commit is contained in:
parent
750d172917
commit
97a8e447d7
@ -81,6 +81,12 @@ class FileChecker implements StatementsSource
|
||||
|
||||
// hoist functions to the top
|
||||
foreach ($stmts as $stmt) {
|
||||
if ($stmt instanceof PhpParser\Node\Stmt\Use_) {
|
||||
foreach ($stmt->uses as $use) {
|
||||
$this->aliased_classes[$use->alias] = implode('\\', $use->name->parts);
|
||||
}
|
||||
}
|
||||
|
||||
if ($stmt instanceof PhpParser\Node\Stmt\Function_) {
|
||||
$function_checkers[$stmt->name] = new FunctionChecker($stmt, $this, $file_context->file_name);
|
||||
}
|
||||
@ -133,12 +139,6 @@ class FileChecker implements StatementsSource
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($stmt instanceof PhpParser\Node\Stmt\Use_) {
|
||||
foreach ($stmt->uses as $use) {
|
||||
$this->aliased_classes[$use->alias] = implode('\\', $use->name->parts);
|
||||
}
|
||||
}
|
||||
|
||||
$leftover_stmts[] = $stmt;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user