File tree Expand file tree Collapse file tree
tests/PHPStan/Rules/Comparison/data Expand file tree Collapse file tree Original file line number Diff line number Diff 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+
2565class ReturnsMaybeNever
2666{
2767 /** @return ($exit is true ? never : 1) */
You can’t perform that action at this time.
0 commit comments