Review main Merged

92073[TASK] Handle most ext:core unit test phpstan baseline entries

Torben Hansen CR +2 V +2 Normal +45 −172 updated 12/12/25, 13:04

Commit message

With this change, most of the ext:core unit test related
phpstan baseline entries are handled, by:

- Ensuring constructor argument usage
- Removing a superfluous assertation
- Adding more precise return doc comments
- Removing a test which constructs an object with an
  invalid type
- Refactoring tests in EmailLinkHandlerTest
- Providing a type annotation in TransportFactoryTest
- Remove a useless test around TreeDataProviderFactory
  that suffers from a broken subject implementation.
- Removing a superfluous type check for a typed variable
- Removing superfluous `array_values` usages
- Removing an empty string check for a variable with is
  never empty

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 13

Review log 1619

  1. Torben Hansen uploaded patch set 1 12/09/25, 19:06

  2. core-ci voted on patch set 1 V +1 12/09/25, 19:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91925

  3. Garvin Hicking commented on patch set 1 12/09/25, 20:02

    QueryBuilderTest.php:1013

    hm, removing this makes the whole test not check what was under test?
  4. Simon Schaufelberger commented on patch set 1 12/09/25, 23:52

    WriterFixture.php:33

    where is this used? imo it should rather not return anything.
  5. Torben Hansen uploaded patch set 2 V +1 12/10/25, 07:42

  6. Torben Hansen commented on patch set 2 12/10/25, 07:46

    QueryBuilderTest.php:1013 Reply

    Good catch. Although I do not fully understand, why we check if the cloned object does not change (should be basic PHP behavior not to do so), I now re-added the assertation. "Fixing" the phpstan issue for the 2nd assertation took almost an hour. It seems, that at some point phpstan "forgets" the type of `$expectedCountSQL` after the first assertation in line 1005. Adding a dedicated `non-empty-string` type declaration for the variable resolved the problem.

    WriterFixture.php:33 Reply

    Please check `WriterInterface->writeLog()`, which by doc annotation must return a `WriterInterface`. So basically, the fixture was wrong by not returning anything.
  7. core-ci voted on patch set 2 V +1 12/10/25, 07:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91963

  8. Oliver Klee voted on patch set 2 V +1 12/10/25, 08:18

  9. Simon Schaufelberger commented on patch set 2 12/10/25, 10:47

    WriterFixture.php:33 Reply

    This should be refactored (in a new patch) to not return anything imo as the WriterInterface->writeLog also doesn't return anything. what do you think?
  10. Simon Schaufelberger commented on patch set 2 CR +1 V +1 12/10/25, 10:50

    WriterFixture.php:33 Reply

    ah sorry, I overlooked that also the interface declares a return type but only in the doc header.
  11. Christian Kuhn commented on patch set 2 CR -1 12/11/25, 21:50

    TreeDataProviderFixture.php:25

    this is odd. this turns the fixture into a full blown subject class. it smells as if we should rather look at the consuming tests instead to see if they are useful or could be done differently. i'd suggest to skip this for now.
  12. Christian Kuhn commented on patch set 2 12/12/25, 12:39

    TreeDataProviderFixture.php:25 Reply

    that fixture is used to test the factory and that factory test is mainly useless. there is not interface to type hint, the technical debt is in the code, not in the test. i'll remove test and fixture for now.
  13. Christian Kuhn uploaded patch set 3 CR +1 V +1 12/12/25, 12:46

  14. Christian Kuhn voted on patch set 3 CR +1 V +1 12/12/25, 12:47

  15. core-ci voted on patch set 3 V +1 12/12/25, 12:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92142

  16. Simon Schaufelberger voted on patch set 3 CR +1 V +1 12/12/25, 12:54

  17. Oliver Klee voted on patch set 3 V +1 12/12/25, 12:57

  18. Christian Kuhn voted on patch set 3 CR +2 V +2 12/12/25, 13:04

  19. Christian Kuhn merged patch set 4 12/12/25, 13:04