-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve dead code detection after nested function calls with conditio…
…nal never return type
- Loading branch information
1 parent
c057aa9
commit d37f51d
Showing
3 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Bug7188; | ||
|
||
use Exception; | ||
|
||
/** | ||
* @param int $x | ||
* @return ($x is 0 ? never : float) | ||
*/ | ||
function inverse($x): float | ||
{ | ||
if ($x===0) { | ||
throw new Exception('Division durch Null.'); | ||
} | ||
|
||
return 1/$x; | ||
} | ||
|
||
function () { | ||
$result = inverse(0); | ||
echo "expect to unreachable\n"; | ||
}; |