Skip to content

Commit

Permalink
improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Nov 18, 2023
1 parent 654ddb3 commit 73ad729
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/UnusedVariableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2142,20 +2142,23 @@ function foo(array $clips) : void {
* @param bool $b
*/
function validate($b, string $source) : void {
/**
* @var bool|string $b
*/
/** @var bool|string $b */
if (!is_bool($b)) {
$source = $b;
$b = false;
}
/**
* test to ensure $b is only type bool and not bool|string anymore
* after we set $b = false; inside the condition above
* @psalm-suppress TypeDoesNotContainType
*/
if (!is_bool($b)) {
echo "this should not happen"
}
print_r($source);
}',
'assertions' => [
'$b===' => 'bool',
],
'ignored_issues' => ['UnusedVariable'],
],
'implicitSpread' => [
'code' => '<?php
Expand Down

0 comments on commit 73ad729

Please sign in to comment.