| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 1 | $declaredClasses = get_declared_classes(); |
|
| 28 | 1 | include $fileInfo[0]; |
|
| 29 | |||
| 30 | 1 | $className = current(array_diff(get_declared_classes(), $declaredClasses)); |
|
| 31 | |||
| 32 | 1 | $classes->offsetSet($className::getType(), $className); |
|
| 33 | 1 | } |
|
| 34 | |||
| 35 | 1 | return static::$dispatcher = new Dispatcher( |
|
| 36 | 1 | $classes, |
|
| 37 | include __DIR__.'/PrecedenceMap.php' |
||
| 38 | 1 | ); |
|
| 39 | } |
||
| 40 | } |
||
| 41 |
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: