Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Ready for review Orphaned

92349[TASK] Replace deprecated usage for custom phpstan rule and add tests

Simon Schaufelberger CR 0 V -1 Hard +404 −1 updated 04/22/26, 10:30

Commit message

Instanceof checks are deprecated and should not be used for checking the
type in phpstan. Use appropriate ways to check the type.

Additionally, the rule is now covered with unit tests.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 11
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/49/92349/11 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/49/92349/11 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V -1 Blocked
    • core-ci -1 CI

Relation chain 2

  1. main 92589[TASK] Replace unneeded instanceof on xxx|null. Use a null check instead Based on this change Work in progress Merge conflict Simon Schaufelberger CR -2 V -1 → 14.3 Normal +55 −68
  2. 92349 [TASK] Replace deprecated usage for custom phpstan rule and add tests This change

Issues 1

Files 14

Review log 2033

Show 58 earlier messages
  1. Simon Schaufelberger uploaded patch set 1 01/16/26, 10:04

  2. core-ci voted on patch set 1 V +1 01/16/26, 10:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93577

  3. Stefan Bürk commented on patch set 1 01/16/26, 11:35

    @simonschaufi+typo3@gmail.com How are the phpstan tests executed ? If we add them they should be executed automatically - as unit tests ? or do we need a addintaion config / runtest type (unit, functional, xxx ?)
  4. Simon Schaufelberger commented on patch set 1 01/16/26, 15:25

    Reply

    So far they are not, I just messaged Lolly to discuss this with him as I've just created a new phpstan rule that he requested and did that as a side work.
  5. Simon Schaufelberger uploaded patch set 2 V +1 01/16/26, 16:57

  6. core-ci voted on patch set 2 V -1 01/16/26, 17:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93621

  7. Simon Schaufelberger uploaded patch set 3 V -1 01/16/26, 17:17

  8. core-ci voted on patch set 3 V -1 01/16/26, 17:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93622

  1. core-ci commented on patch set 3 01/16/26, 17:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93622

  2. Stefan Bürk uploaded patch set 4 V -1 01/16/26, 21:45

  3. Stefan Bürk uploaded patch set 5 01/16/26, 21:48

  4. Simon Schaufelberger commented on patch set 5 01/16/26, 21:58

    runTests.sh:1485

    random is not necessary as there are absolutely no dependencies between tests.
  5. core-ci voted on patch set 5 V +1 01/16/26, 21:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93639

  6. Stefan Bürk commented on patch set 5 01/16/26, 22:03

    runTests.sh:1485 Reply

    We can consider that and remove it again - let's see what the outcom is. In the end we do not know ;) But I guess we are going to drop random again.
  7. core-ci voted on patch set 4 V +1 01/16/26, 22:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93637

  8. Stefan Bürk uploaded patch set 6 V +1 01/16/26, 22:12

  9. Simon Schaufelberger commented on patch set 6 01/16/26, 22:14

    runTests.sh:1485 Reply

    Done
  10. Simon Schaufelberger commented on patch set 6 01/16/26, 22:14

    Reply

    Done
  11. Stefan Bürk commented on patch set 6 01/16/26, 22:14

    runTests.sh:1485 Reply

    Removed the random tests again and fixed the "nightly" runs.
  12. core-ci voted on patch set 6 V +1 01/16/26, 22:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93643

  13. core-ci commented on patch set 6 01/16/26, 22:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93644

  14. Stefan Bürk uploaded patch set 7 V +1 01/16/26, 22:33

  15. core-ci voted on patch set 7 V +1 01/16/26, 22:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93645

  16. core-ci commented on patch set 7 01/16/26, 22:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93646

  17. Oliver Klee voted on patch set 7 V +1 01/21/26, 16:30

  18. Stefan Bürk commented on patch set 7 01/21/26, 23:04

    InstanceOfWithMethodCall.php:33 Unresolved

    Not sure, but I would say that this case should also trigger the phpstan error. Return type of called `getObject()` is concrete, allow only \stdClass or null - and the whole thing about the rule was to use a null check over a instanceof check when the type is simple enough and ensured. Which it is in this case. That's unrelated to the change and even with the unchanged rule all tests are green. So no change in behavour for the rule. Still - I'd say that we have here a case which should be the other way round then the added tests.
  19. Simon Schaufelberger uploaded patch set 8 V +1 01/30/26, 12:34

  20. Simon Schaufelberger rebased onto patch set 9 01/30/26, 13:33

  21. core-ci voted on patch set 9 V -1 01/30/26, 14:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94667

  22. Simon Schaufelberger uploaded patch set 10 V -1 03/10/26, 20:19

  23. core-ci voted on patch set 10 V -1 03/10/26, 20:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97717

  24. Benni Mack updated the commit message in patch set 11 V -1 04/22/26, 06:41

  25. core-ci voted on patch set 11 V -1 04/22/26, 10:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100760