Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 2.032 |
Changes | 0 |
1 | <?php |
||
43 | 92 | public function isFunctionInternal(string $name): bool |
|
44 | { |
||
45 | try { |
||
46 | 92 | return (new ReflectionFunction($name))->isInternal(); |
|
47 | |||
48 | // TODO: leverage Better Reflection instead |
||
49 | return $this->functionReflector->reflect($name)->isInternal(); |
||
|
|||
50 | 30 | } catch (ReflectionException $exception) { |
|
51 | 30 | return false; |
|
52 | } |
||
53 | } |
||
54 | } |
||
55 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.