Skip to content

Commit 584d872

Browse files
committed
Reapply "test union"
This reverts commit 63415ca.
1 parent d5ae423 commit 584d872

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,27 @@ function test(): void
165165
{
166166
// send 404 header
167167
notFound(false);
168+
}
169+
170+
171+
class ReturnViaUnion
172+
{
173+
/**
174+
* @return ($exit is int ? void : never)
175+
*/
176+
public static function notFound(int|string $exit = 'hello world'): void
177+
{
178+
header('HTTP/1.1 404 Not Found', true, 404);
179+
180+
if (!is_int($exit)) {
181+
echo '404 Not Found';
182+
exit;
183+
}
184+
}
168185

186+
public function test(): void
187+
{
188+
// send 404 header
189+
self::notFound(0);
190+
}
169191
}

0 commit comments

Comments
 (0)