1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Avoid false-positives while analysing memoised coalesce

This commit is contained in:
Matt Brown 2020-12-02 02:25:15 -05:00 committed by Daniil Gentili
parent fd7afc9c40
commit a93eb0eab4
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -35,7 +35,10 @@ class CoalesceAnalyzer
) { ) {
$left_var_id = '$<tmp coalesce var>' . (int) $left_expr->getAttribute('startFilePos'); $left_var_id = '$<tmp coalesce var>' . (int) $left_expr->getAttribute('startFilePos');
ExpressionAnalyzer::analyze($statements_analyzer, $left_expr, clone $context); $cloned = clone $context;
$cloned->inside_isset = true;
ExpressionAnalyzer::analyze($statements_analyzer, $left_expr, $cloned);
$condition_type = $statements_analyzer->node_data->getType($left_expr) ?: Type::getMixed(); $condition_type = $statements_analyzer->node_data->getType($left_expr) ?: Type::getMixed();