-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
4.3.1, 4.4
-
MOODLE_403_STABLE, MOODLE_404_STABLE
https://stitcher.io/blog/override-in-php-83
This is an awesome and handy feature which we should consider requiring asap.
There is no issue with requiring it in older code, and it will only break in PHP 8.3 if there is an actual problem (which is what we want).
Essentially it can be applie dto a method which you are using to override a parent class method and it states "I know this method should override a parent method. If that ever changes, I need to know".
If the parent class becomes refactored at some point such that the child method no longer has the same impact, it will throw a runtime warning.
Unfortunately due to our size, and legacy, we've had issues with getting static analysis to work in a meaningful way for Moodle.
That is gradually improving, but it's a very slow road and requires a lot of fixes to legacy code. This is a very helpful stop-gap while we get to that point (which will take years).