1
0
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:
Matthew Brown 2017-01-09 00:56:51 -05:00
parent f318c52876
commit bf76843d94

View File

@ -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;
}
}
}
}
}