Review main Merged

87278[TASK] Resolve many phpstan staticMethod.alreadyNarrowedType findings

Christian Kuhn CR +2 V +2 Expert +344 −944 updated 12/02/24, 14:23

Commit message

Resolve most phpstan "staticMethod.alreadyNarrowedType" findings
in tests in ext:backend and ext:core.

In general, assertions that are ensured by PHP hints
(and partially annotations) are considered "useless" by
phpstan.

There is a series of strategies to deal with single places:
* Remove some tests that are completely useless, or
  indirectly tested by more detailed tests.
* Remove an assertion and add attribute #[DoesNotPerformAssertions],
  rename some tests accordingly, typically "...DoesNotThrowException"
  or "...CanBeInstantiated".
* Add a return type hint in subject to be sure subject returns
  some specific type, then remove the test or go with
  #[DoesNotPerformAssertions] attribute.
* Narrow down a given assertion to something more specific.

As usual for this type of patches, tests are consolidated
and streamlined along the way, typically reducing state
within tests by avoiding setUp() methods, turning stuff
into constants, setting things private and similar.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Markus Klein +1
    • Anja Leichsenring +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Markus Klein +1
    • Anja Leichsenring +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 58

Show 38 more files

Review log 1423

  1. Christian Kuhn uploaded patch set 1 11/28/24, 20:25

  2. core-ci voted on patch set 1 V +1 11/28/24, 20:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70315

  3. Christian Kuhn uploaded patch set 2 V +1 11/29/24, 09:44

  4. core-ci voted on patch set 2 V -1 11/29/24, 09:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70345

  5. Christian Kuhn uploaded patch set 3 V -1 11/29/24, 10:09

  6. core-ci voted on patch set 3 V +1 11/29/24, 10:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70346

  7. Christian Kuhn rebased onto patch set 4 V +1 12/02/24, 10:45

  8. core-ci voted on patch set 4 V -1 12/02/24, 10:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70447

  9. Christian Kuhn uploaded patch set 5 V -1 12/02/24, 11:44

  10. core-ci voted on patch set 5 V +1 12/02/24, 11:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70453

  11. Christian Kuhn uploaded patch set 6 V +1 12/02/24, 12:29

  12. core-ci voted on patch set 6 V -1 12/02/24, 12:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70456

  13. Christian Kuhn uploaded patch set 7 V -1 12/02/24, 13:08

  14. core-ci voted on patch set 7 V -1 12/02/24, 13:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70457

  15. Christian Kuhn uploaded patch set 8 V -1 12/02/24, 13:44

  16. Christian Kuhn updated the commit message in patch set 9 12/02/24, 13:46

  17. core-ci voted on patch set 8 V +1 12/02/24, 13:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70458

  18. core-ci voted on patch set 9 V +1 12/02/24, 13:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70459

  19. Anja Leichsenring voted on patch set 9 CR +1 V +1 12/02/24, 14:03

  20. Stefan Bürk voted on patch set 9 CR +1 V +1 12/02/24, 14:14

  21. Markus Klein voted on patch set 9 CR +1 V +1 12/02/24, 14:18

  22. Christian Kuhn voted on patch set 9 CR +2 V +2 12/02/24, 14:23

  23. Christian Kuhn merged patch set 10 12/02/24, 14:23