| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 7 | private static function getFunctionName(\ReflectionFunctionAbstract $reflection) : string |
|
| 34 | { |
||
| 35 | 7 | $name = $reflection->name.'()'; |
|
| 36 | |||
| 37 | 7 | if ($reflection instanceof \ReflectionMethod) { |
|
| 38 | 6 | $name = $reflection->getDeclaringClass()->name.'::'.$name; |
|
| 39 | } |
||
| 40 | |||
| 41 | 7 | return $name; |
|
| 42 | } |
||
| 43 | } |
||
| 44 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClassto useselfinstead: