Review main Merged

91400[TASK] Cleanup phpstan baseline for extbase functional tests

Torben Hansen CR +2 V +2 Normal +12 −95 updated 11/03/25, 09:03

Commit message

The phpstan baseline contains several excludes for extbase
functional tests. Those excludes are related to already
resolved types and non-initialized properties and
variables.

This change adapts the tests as follows:

* superfluous null coalescing checks are removed
* superfluous `assertInstanceOf` assertations are removed
* `@var` declarations are moved after `assertInstanceOf`
  assertations where suitable
* `@var` declarations are added to ensure correct type
  resolution
* DI check in `ValidationResolverTest` has been refactored

The adaptions result in the removal of 12 excludes in the
phpstan baseline file.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Klee +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • core-ci +1 CI

Issues 1

Files 10

Review log 1214

  1. Torben Hansen uploaded patch set 1 11/01/25, 08:53

  2. core-ci voted on patch set 1 V +1 11/01/25, 09:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88301

  3. Simon Schaufelberger voted on patch set 1 CR +1 V +1 11/01/25, 17:59

  4. Simon Schaufelberger commented on patch set 1 11/01/25, 18:00

    would it be good to backport this?
  5. Oliver Klee commented on patch set 1 V +1 11/02/25, 10:01

    PropertyMapperTest.php:224

    This line shouldn't be necessary as the `phpstan/phpstan-phpunit` package can deduct this from the `assertInstanceOf` call.

    PropertyMapperTest.php:246

    Ditto.

    PropertyMapperTest.php:291

    Ditto.
  6. Torben Hansen commented on patch set 1 11/02/25, 11:37

    Reply

    I do not this that it would provide any value for v13.

    PropertyMapperTest.php:224 Reply

    I moved those after the `assertInstanceOf`, so we still have code completion for the object in the IDE. OK to keep them? What do you think?
  7. Oliver Klee commented on patch set 1 11/02/25, 12:11

    PropertyMapperTest.php:224 Reply

    I'd prefer to not have the type annotation (as redundant PHPDoc type annotations need to be maintained manually and tend to get out of sync). I don't see this as a blocker for me, though. So if you strongly prefer to keep them, please feel free do so.
  8. Torben Hansen uploaded patch set 2 CR +1 V +1 11/02/25, 13:16

  9. Torben Hansen commented on patch set 2 11/02/25, 13:23

    PropertyMapperTest.php:224 Reply

    Thanks for sharing your thoughts. I have now removed the `@var` annotations for affected variables in `PropertyMapperTest`. It seems, the IDE (at least phpstorm/intellij) also resolves the type of `$result` and provides code completion for properties and methods.
  10. Torben Hansen commented on patch set 2 11/02/25, 13:23

    PropertyMapperTest.php:246 Reply

    Done

    PropertyMapperTest.php:291 Reply

    Done
  11. core-ci voted on patch set 2 V +1 11/02/25, 13:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88320

  12. Oliver Klee voted on patch set 2 CR +1 V +1 11/02/25, 14:37

  13. Benni Mack voted on patch set 2 CR +2 V +2 11/03/25, 09:03

  14. Benni Mack merged patch set 3 11/03/25, 09:03