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

Magic methods signature checks

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.11, 4.0
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None

      Description

      From CHANGELOG:

      . Magic Methods will now have their arguments and return types checked if
      they have them declared. The signatures should match the following list:

      __call(string $name, array $arguments): mixed
      __callStatic(string $name, array $arguments): mixed
      __clone(): void
      __debugInfo(): ?array
      __get(string $name): mixed
      __invoke(mixed $arguments): mixed
      __isset(string $name): bool
      __serialize(): array
      __set(string $name, mixed $value): void
      __set_state(array $properties): object
      __sleep(): array
      __unserialize(array $data): void
      __unset(string $name): void
      __wakeup(): void

      RFC: https://wiki.php.net/rfc/magic-methods-signature

      Regular expression used to detect all uses and fix them when needed:

      ag '__call|__callStatic|__clone|__debugInfo|\
      __get__invoke|__isset|__serialize|__set|\
      __set_state|__sleep|__unserialize|__unset|__wakeup' --php
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h