mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix view checks
This commit is contained in:
parent
899f74b12e
commit
faae9062ba
@ -318,6 +318,8 @@ abstract class ClassLikeChecker implements StatementsSource
|
||||
return self::$method_checkers[$method_id];
|
||||
}
|
||||
|
||||
ClassMethodChecker::registerClassMethod($method_id);
|
||||
|
||||
$declaring_method_id = ClassMethodChecker::getDeclaringMethod($method_id);
|
||||
$declaring_class = explode('::', $declaring_method_id)[0];
|
||||
|
||||
@ -329,10 +331,11 @@ abstract class ClassLikeChecker implements StatementsSource
|
||||
|
||||
foreach ($class_checker->class->stmts as $stmt) {
|
||||
if ($stmt instanceof PhpParser\Node\Stmt\ClassMethod) {
|
||||
$method_checker = new ClassMethodChecker($stmt, $class_checker);
|
||||
$method_id = $class_checker->absolute_class . '::' . $stmt->name;
|
||||
self::$method_checkers[$method_id] = $method_checker;
|
||||
return $method_checker;
|
||||
if ($declaring_method_id === $class_checker->absolute_class . '::' . $stmt->name) {
|
||||
$method_checker = new ClassMethodChecker($stmt, $class_checker);
|
||||
self::$method_checkers[$method_id] = $method_checker;
|
||||
return $method_checker;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ class ClassMethodChecker extends FunctionLikeChecker
|
||||
}
|
||||
}
|
||||
|
||||
protected static function registerClassMethod($method_id)
|
||||
public static function registerClassMethod($method_id)
|
||||
{
|
||||
ClassLikeChecker::registerClass(explode('::', $method_id)[0]);
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ abstract class FunctionLikeChecker implements StatementsSource
|
||||
// if we know that the function has no effects on vars, we don't bother rechecking
|
||||
if (isset(self::$no_effects_hashes[$hash])) {
|
||||
list($context->vars_in_scope, $context->vars_possibly_in_scope) = self::$no_effects_hashes[$hash];
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user