| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 58 | private static function kernelVersionCompare($operator, $major, $minor = null, $patch = null) |
||
| 59 | { |
||
| 60 | $vernum = $major; |
||
| 61 | $kernel = Kernel::MAJOR_VERSION; |
||
| 62 | |||
| 63 | if ($minor) { |
||
| 64 | $vernum .= '.'.$minor; |
||
| 65 | $kernel .= '.'.Kernel::MINOR_VERSION; |
||
| 66 | |||
| 67 | if ($patch) { |
||
| 68 | $vernum .= '.'.$patch; |
||
| 69 | $kernel .= '.'.Kernel::RELEASE_VERSION; |
||
| 70 | } |
||
| 71 | } |
||
| 72 | |||
| 73 | return version_compare($kernel, $vernum, $operator); |
||
| 74 | } |
||
| 75 | } |
||
| 76 |
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: