Skip to content

Commit 59a1dfc

Browse files
committed
more tests
1 parent ae982ee commit 59a1dfc

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,11 @@ public function testBug13566(): void
11691169
$this->analyse([__DIR__ . '/data/bug-13566.php'], [
11701170
[
11711171
'Call to function is_numeric() with 123 will always evaluate to true.',
1172-
197,
1172+
199,
1173+
],
1174+
[
1175+
'Call to function assertIsInt() with int will always evaluate to true.',
1176+
204,
11731177
],
11741178
]);
11751179
}

tests/PHPStan/Rules/Comparison/data/bug-13566.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Bug13566;
66

7+
use LogicException;
8+
79
class ReturnViaBool
810
{
911
/** @return ($exit is true ? never : void) */
@@ -196,3 +198,15 @@ public function test(): void
196198
$x = 123;
197199
if (is_numeric($x)) {
198200
}
201+
202+
function doFoo($mixed) {
203+
assertIsInt($mixed);
204+
assertIsInt($mixed);
205+
}
206+
207+
/** @phpstan-assert int $i */
208+
function assertIsInt($i):void {
209+
if (!is_int($i)) {
210+
throw new \LogicException();
211+
}
212+
}

0 commit comments

Comments
 (0)