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:
parent
da257a0fa5
commit
8a2983e5e9
@ -1273,14 +1273,6 @@ class AssignmentAnalyzer
|
||||
$statements_analyzer->node_data->setType($stmt, $fake_coalesce_type);
|
||||
}
|
||||
|
||||
BinaryOpAnalyzer::addDataFlow(
|
||||
$statements_analyzer,
|
||||
$stmt,
|
||||
$stmt->var,
|
||||
$stmt->expr,
|
||||
'coalesce'
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2188,6 +2188,14 @@ class UnusedVariableTest extends TestCase
|
||||
print_r(...func_get_args());
|
||||
}'
|
||||
],
|
||||
'nullCoalesce' => [
|
||||
'<?php
|
||||
function foo (?bool $b, int $c): void {
|
||||
$b ??= $c;
|
||||
|
||||
echo $b;
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user