Skip to content

Commit 1e0bddd

Browse files
committed
Update bug-13566.php
1 parent dc86569 commit 1e0bddd

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,46 @@ public function test(): void
2222
}
2323
}
2424

25+
class ReturnViaInt
26+
{
27+
/** @return ($exit is 1 ? never : void) */
28+
public static function notFound(int $exit = 1): void
29+
{
30+
header('HTTP/1.1 404 Not Found', true, 404);
31+
32+
if ($exit == 1) {
33+
echo '404 Not Found';
34+
exit;
35+
}
36+
}
37+
38+
public function test(): void
39+
{
40+
// send 404 header
41+
self::notFound(0);
42+
}
43+
}
44+
45+
class ReturnViaIntNonNative
46+
{
47+
/** @return ($exit is 1 ? never : void) */
48+
public static function notFound(int $exit = 1)
49+
{
50+
header('HTTP/1.1 404 Not Found', true, 404);
51+
52+
if ($exit == 1) {
53+
echo '404 Not Found';
54+
exit;
55+
}
56+
}
57+
58+
public function test(): void
59+
{
60+
// send 404 header
61+
self::notFound(0);
62+
}
63+
}
64+
2565
class ReturnsMaybeNever
2666
{
2767
/** @return ($exit is true ? never : 1) */

0 commit comments

Comments
 (0)