mirror of
https://github.com/danog/psalm.git
synced 2024-12-02 09:37:59 +01:00
Put back function hoisting
This commit is contained in:
parent
cd36893b9f
commit
ccad9978f5
@ -120,6 +120,14 @@ class StatementsChecker
|
|||||||
|
|
||||||
$function_checkers = [];
|
$function_checkers = [];
|
||||||
|
|
||||||
|
// hoist functions to the top
|
||||||
|
foreach ($stmts as $stmt) {
|
||||||
|
if ($stmt instanceof PhpParser\Node\Stmt\Function_) {
|
||||||
|
$function_checker = new FunctionChecker($stmt, $this->source, $context->file_name);
|
||||||
|
$function_checkers[$stmt->name] = $function_checker;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($stmts as $stmt) {
|
foreach ($stmts as $stmt) {
|
||||||
foreach (Config::getInstance()->getPlugins() as $plugin) {
|
foreach (Config::getInstance()->getPlugins() as $plugin) {
|
||||||
if ($plugin->checkStatement($stmt, $context, $this->file_name) === false) {
|
if ($plugin->checkStatement($stmt, $context, $this->file_name) === false) {
|
||||||
@ -186,8 +194,8 @@ class StatementsChecker
|
|||||||
}
|
}
|
||||||
|
|
||||||
} elseif ($stmt instanceof PhpParser\Node\Stmt\Function_) {
|
} elseif ($stmt instanceof PhpParser\Node\Stmt\Function_) {
|
||||||
$function_checker = new FunctionChecker($stmt, $this->source, $context->file_name);
|
$function_context = new Context($this->file_name, $context->self);
|
||||||
$function_checker->check(new Context($this->file_name, $context->self));
|
$function_checkers[$stmt->name]->check($function_context);
|
||||||
|
|
||||||
} elseif ($stmt instanceof PhpParser\Node\Expr) {
|
} elseif ($stmt instanceof PhpParser\Node\Expr) {
|
||||||
$this->checkExpression($stmt, $context);
|
$this->checkExpression($stmt, $context);
|
||||||
|
Loading…
Reference in New Issue
Block a user