mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix foreach dependency errors
This commit is contained in:
parent
f318c52876
commit
bf76843d94
@ -131,6 +131,19 @@ class ForeachChecker
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($return_type->value !== 'Traversable' &&
|
||||
$return_type->value !== $statements_checker->getClassName()
|
||||
) {
|
||||
if (ClassLikeChecker::checkFullyQualifiedClassLikeName(
|
||||
$return_type->value,
|
||||
$statements_checker->getFileChecker(),
|
||||
new CodeLocation($statements_checker->getSource(), $stmt->expr),
|
||||
$statements_checker->getSuppressedIssues()
|
||||
) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ClassChecker::classImplements(
|
||||
$return_type->value,
|
||||
'Iterator'
|
||||
@ -155,19 +168,6 @@ class ForeachChecker
|
||||
$value_type = Type::getMixed();
|
||||
}
|
||||
}
|
||||
|
||||
if ($return_type->value !== 'Traversable' &&
|
||||
$return_type->value !== $statements_checker->getClassName()
|
||||
) {
|
||||
if (ClassLikeChecker::checkFullyQualifiedClassLikeName(
|
||||
$return_type->value,
|
||||
$statements_checker->getFileChecker(),
|
||||
new CodeLocation($statements_checker->getSource(), $stmt->expr),
|
||||
$statements_checker->getSuppressedIssues()
|
||||
) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user