Conditions | 5 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 8.125 |
Changes | 0 |
1 | <?php |
||
55 | 3 | private function getSubjectNamespaceName(Reflector $subject) : string |
|
56 | { |
||
57 | 3 | if ($subject instanceof ReflectionClass || $subject instanceof ReflectionFunction) { |
|
58 | 3 | return $subject->getNamespaceName(); |
|
59 | } |
||
60 | |||
61 | if ($subject instanceof ReflectionProperty || $subject instanceof ReflectionMethod) { |
||
62 | return $subject->getDeclaringClass()->getNamespaceName(); |
||
63 | } |
||
64 | |||
65 | assert(false, 'Unsupported Reflector'); |
||
|
|||
66 | } |
||
68 |
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: