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

Fix string assertion for ternaries

This commit is contained in:
Matt Brown 2018-05-07 17:52:18 -04:00
parent f858924b60
commit 3c9e42f884
2 changed files with 4 additions and 3 deletions

View File

@ -55,7 +55,7 @@ class TernaryChecker
) )
); );
$reconcilable_if_types = Algebra::getTruthsFromFormula($ternary_clauses); $reconcilable_if_types = Algebra::getTruthsFromFormula($ternary_clauses, $new_referenced_var_ids);
$changed_var_ids = []; $changed_var_ids = [];

View File

@ -815,8 +815,9 @@ class TypeAlgebraTest extends TestCase
'<?php '<?php
$s = rand(0, 1) ? "a" : "b"; $s = rand(0, 1) ? "a" : "b";
if (($s === "a" && rand(0, 1)) if (($s === "a" && rand(0, 1)) || ($s === "b" && rand(0, 1))) {}
|| ($s === "b" && rand(0, 1))) {}',
$a = (($s === "a" && rand(0, 1)) || ($s === "b" && rand(0, 1))) ? 1 : 0;',
], ],
]; ];
} }