1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Make sure yield from expressions counted as used

Fixes #2823
This commit is contained in:
Matthew Brown 2020-02-17 19:21:04 -05:00
parent cf977c3542
commit 3561c7d5dc

View File

@ -1802,7 +1802,13 @@ class ExpressionAnalyzer
PhpParser\Node\Expr\YieldFrom $stmt,
Context $context
) {
$was_inside_call = $context->inside_call;
$context->inside_call = true;
if (self::analyze($statements_analyzer, $stmt->expr, $context) === false) {
$context->inside_call = $was_inside_call;
return false;
}
@ -1830,6 +1836,8 @@ class ExpressionAnalyzer
$statements_analyzer->node_data->setType($stmt, $yield_from_type ?: Type::getMixed());
}
$context->inside_call = $was_inside_call;
return null;
}