mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Fix strict reconciliation of bools
This commit is contained in:
parent
3c9e42f884
commit
0eda76b742
@ -863,7 +863,9 @@ class Reconciler
|
||||
$did_remove_type = false;
|
||||
|
||||
foreach ($existing_var_atomic_types as $type) {
|
||||
if (!$type instanceof TBool) {
|
||||
if (!$type instanceof TBool
|
||||
|| ($is_strict_equality && get_class($type) === TBool::class)
|
||||
) {
|
||||
$non_bool_types[] = $type;
|
||||
} else {
|
||||
$did_remove_type = true;
|
||||
|
@ -819,6 +819,18 @@ class TypeAlgebraTest extends TestCase
|
||||
|
||||
$a = (($s === "a" && rand(0, 1)) || ($s === "b" && rand(0, 1))) ? 1 : 0;',
|
||||
],
|
||||
'boolComparison' => [
|
||||
'<?php
|
||||
$a = (bool) rand(0, 1);
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$a = null;
|
||||
}
|
||||
|
||||
if ($a !== (bool) rand(0, 1)) {
|
||||
echo $a === false ? "a" : "b";
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user