mirror of
https://github.com/danog/psalm.git
synced 2025-01-18 19:42:21 +01:00
Remove ClassChecker and Traversable lookups
This commit is contained in:
parent
c770146bac
commit
7c72465325
@ -162,9 +162,9 @@ class FileChecker implements StatementsSource
|
||||
return !self::$_var_dump_fn || call_user_func(self::$_var_dump_fn, $file_name);
|
||||
}
|
||||
|
||||
public static function shouldCheckClassProperties($file_name, ClassChecker $class_checker = null)
|
||||
public static function shouldCheckClassProperties($file_name)
|
||||
{
|
||||
return !self::$_class_property_fn || call_user_func(self::$_class_property_fn, $file_name, $class_checker);
|
||||
return !self::$_class_property_fn || call_user_func(self::$_class_property_fn, $file_name);
|
||||
}
|
||||
|
||||
public function registerFunction(PhpParser\Node\Stmt\Function_ $function)
|
||||
|
@ -752,8 +752,9 @@ class StatementsChecker
|
||||
{
|
||||
if ($stmt->var instanceof PhpParser\Node\Expr\Variable) {
|
||||
if ($stmt->var->name === 'this') {
|
||||
$class_checker = $this->_source->getClassChecker();
|
||||
if ($class_checker) {
|
||||
if (!FileChecker::shouldCheckClassProperties($this->_file_name)) {
|
||||
// ignore this property
|
||||
} elseif ($class_checker = $this->_source->getClassChecker()) {
|
||||
if (is_string($stmt->name)) {
|
||||
$property_names = $class_checker->getPropertyNames();
|
||||
|
||||
@ -894,10 +895,6 @@ class StatementsChecker
|
||||
|
||||
if ($return_type !== 'array' && $return_type !== 'Traversable' && $return_type !== $this->_class_name) {
|
||||
ClassChecker::checkAbsoluteClass($return_type, $stmt, $this->_file_name);
|
||||
|
||||
if (!ClassChecker::classImplements($return_type, 'Traversable')) {
|
||||
throw new IteratorException('Class ' . $return_type . ' does not implement the Traversable interface', $this->_file_name, $stmt->getLine());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user