| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | private static function completeHelpMessage($serviceId) |
||
| 15 | { |
||
| 16 | $helpMessages = [ |
||
| 17 | ValidatorMiddlewarePass::SERVICE_ID => 'You should have the symfony validator service enabled to use this middleware.', |
||
| 18 | SecurityMiddlewarePass::SERVICE_ID => 'You should have the symfony security service enabled to use this middleware.', |
||
| 19 | ]; |
||
| 20 | |||
| 21 | if (array_key_exists($serviceId, $helpMessages)) { |
||
| 22 | return $helpMessages[$serviceId]; |
||
| 23 | } |
||
| 24 | } |
||
| 25 | } |
||
| 26 |
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: