Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-79901

Consider requiring adoption of #[Override] attribute

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.3.1, 4.4
    • Policy

      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).

            Unassigned Unassigned
            dobedobedoh Andrew Lyons
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.