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

Fix #4336 - don’t merge sources twice for null coalesce

This commit is contained in:
Matt Brown 2020-10-15 09:57:37 -04:00
parent da257a0fa5
commit 8a2983e5e9
2 changed files with 8 additions and 8 deletions

View File

@ -1273,14 +1273,6 @@ class AssignmentAnalyzer
$statements_analyzer->node_data->setType($stmt, $fake_coalesce_type); $statements_analyzer->node_data->setType($stmt, $fake_coalesce_type);
} }
BinaryOpAnalyzer::addDataFlow(
$statements_analyzer,
$stmt,
$stmt->var,
$stmt->expr,
'coalesce'
);
return true; return true;
} }

View File

@ -2188,6 +2188,14 @@ class UnusedVariableTest extends TestCase
print_r(...func_get_args()); print_r(...func_get_args());
}' }'
], ],
'nullCoalesce' => [
'<?php
function foo (?bool $b, int $c): void {
$b ??= $c;
echo $b;
}'
],
]; ];
} }