Skip to content

Commit d86d352

Browse files
committed
add more tests
1 parent edaae9f commit d86d352

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,14 @@ public function testBug12087c(): void
10831083
17,
10841084
$tipText,
10851085
],
1086+
[
1087+
'Call to function is_null() with 10 will always evaluate to false.',
1088+
23,
1089+
],
1090+
[
1091+
'Call to function is_null() with null will always evaluate to true.',
1092+
29,
1093+
],
10861094
]);
10871095
}
10881096

tests/PHPStan/Rules/Comparison/data/bug-12087c.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,16 @@ function doFoo()
1616

1717
is_null($value = $foo = Button::tryFrom($value));
1818
}
19+
20+
function doFoo2() {
21+
$value = 10;
22+
23+
is_null($value ??= Button::tryFrom($value));
24+
}
25+
26+
function doFoo3() {
27+
$value = null;
28+
29+
is_null($value ??= Button::tryFrom($value));
30+
}
31+

0 commit comments

Comments
 (0)