Review main Merged

84857[TASK] Avoid implicitly nullable class method parameter in tests

Stefan Bürk CR +2 V +2 Normal +71 −71 updated 06/23/24, 12:55

Commit message

With PHP 8.4 marking method parameter implicitly nullable
is depreacted and will emit a `E_DEPRECATED` warning. One
recommended way to resolve this, is making it explicitly
nullable using the `?` nullable operator. [1]

In cases, where are implicitly nullable parameter exists
before not-nullable parameters in a method or constructor,
making it explicitly nullable will emit a

  Optional parameter <paramname> declared before required
  parameter <paramname> is implicitly treated as a required
  parameter

since PHP 8.0 [2].

This change adds the `?` nullable operator [1] and removes
the null default value when one or more non-optional argument
follows [2] to mitigate both issues.

Note that the second case is a edge case in this change.

This prepares the way towards PHP 8.4 compatibility and
unifies towards using `?` nullable operator over union
null type when possible.

[1] https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated
[2] https://php.watch/versions/8.0/deprecate-required-param-after-optional

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Anja Leichsenring +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Anja Leichsenring +1
    • core-ci +1 CI

Issues 1

Files 51

Show 31 more files

Review log 913

  1. Stefan Bürk uploaded patch set 1 06/23/24, 03:05

  2. core-ci voted on patch set 1 V -1 06/23/24, 03:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60078

  3. Stefan Bürk uploaded patch set 2 V -1 06/23/24, 11:07

  4. Stefan Bürk rebased onto patch set 3 06/23/24, 11:11

  5. core-ci voted on patch set 2 V +1 06/23/24, 11:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60095

  6. core-ci voted on patch set 3 V +1 06/23/24, 11:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60097

  7. Stefan Bürk updated the commit message in patch set 4 V +1 06/23/24, 11:32

  8. core-ci voted on patch set 4 V +1 06/23/24, 11:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60099

  9. Oliver Klee voted on patch set 4 V +1 06/23/24, 11:48

  10. Oliver Klee voted on patch set 4 CR +1 06/23/24, 11:58

  11. Anja Leichsenring voted on patch set 4 CR +1 V +1 06/23/24, 12:20

  12. Stefan Bürk voted on patch set 4 CR +2 V +2 06/23/24, 12:55

  13. Stefan Bürk merged patch set 5 06/23/24, 12:55