Review main Merged

73037[TASK] Revamp phpstan config and handling

Stefan Bürk CR +2 V +2 Impossible +10166 −683 updated 01/29/22, 18:46

Commit message

We currently have the situation that phpstan is
hard to update and maintain due to the phpstan
config file that sets very specific rulesets.

This is unfortunate since phpstan tends to change
and rename rules at will.

The general usage API of phpstan is basically as
follows: Have a slim config file that sets the
basic level. Then maintain a 'baseline' file that
lists violations, using the --generate-baseline
command option. The todo job for people working
on phpstan errors is then to look at the baseline
file, pick up some issues, fix them, then re-generate
baseline. When baseline is small enough, the level
is raised, a new baseline is generated, and the
fix-job starts again.

The patch does exactly this: The existing config
is dropped and runTests.sh receives a command to
generate baseline.

With this in place, we can easily raise phpstan
to a PHP 8.1 compatible version:

> composer req friendsoftypo3/phpstan-typo3:"^0.9.0" --dev
> composer req phpstan/phpstan:"^1.4.3" --dev
> Build/Script/runTests.sh -s phpstanGenerateBaseline

This initialy adds about 4000 ignores to the baseline
with level 3, but we can reduce this drastically with
just a couple of dedicated patches, soon.

The config is heavily streamlined and for instance does
*not* ignore tests anymore, which actually finds a ton
of misuses and bugs within tests and classes.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Daniel Goerz +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Daniel Goerz +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 22

Review log 2030

Show 35 earlier messages
  1. Stefan Bürk uploaded patch set 1 01/16/22, 20:54

  2. core-ci voted on patch set 1 V -1 01/16/22, 21:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22155

  3. Stefan Bürk uploaded patch set 2 01/17/22, 08:44

  4. Stefan Bürk commented on patch set 2 01/17/22, 08:53

    changed from fork to release of friendsoftypo3/phpstan-typo3 with phpstan 1.2.0 compatibility
  5. core-ci voted on patch set 2 V -1 01/17/22, 09:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22173

  1. Stefan Bürk uploaded patch set 3 01/19/22, 13:04

  2. core-ci voted on patch set 3 V -1 01/19/22, 13:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22265

  3. Stefan Bürk rebased onto patch set 4 01/19/22, 14:29

  4. core-ci voted on patch set 4 V -1 01/19/22, 14:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22270

  5. Stefan Bürk uploaded patch set 5 01/29/22, 12:59

  6. core-ci voted on patch set 5 V -1 01/29/22, 13:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22655

  7. Stefan Bürk uploaded patch set 6 01/29/22, 13:24

  8. Stefan Bürk uploaded patch set 7 01/29/22, 13:31

  9. core-ci voted on patch set 6 V -1 01/29/22, 13:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22656

  10. core-ci voted on patch set 7 V -1 01/29/22, 13:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22657

  11. Christian Kuhn uploaded patch set 8 01/29/22, 16:21

  12. core-ci voted on patch set 8 V +1 01/29/22, 16:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22658

  13. Christian Kuhn uploaded patch set 9 01/29/22, 16:58

  14. Christian Kuhn updated the commit message in patch set 10 01/29/22, 16:58

  15. Stefan Bürk voted on patch set 10 CR +1 01/29/22, 17:01

  16. Christian Kuhn uploaded patch set 11 01/29/22, 17:09

  17. core-ci voted on patch set 10 V +1 01/29/22, 17:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22662

  18. core-ci voted on patch set 11 V +1 01/29/22, 17:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22664

  19. Stefan Bürk voted on patch set 11 CR +1 01/29/22, 17:23

  20. Christian Kuhn voted on patch set 11 V +1 CR +1 01/29/22, 17:24

  21. Daniel Goerz commented on patch set 11 V +1 CR +1 01/29/22, 17:33

    The initial idea of the config was to have as many rules active as possible while working on fulfilling whole levels. This is bad for maintainability, so I support the approach to introduce a baseline. I would, however, go for a higher level then, because the baseline enables us to go to moon and grab for the stars ... 😊 Don't take that too serious, I am fine with level 3 as well. If we increase the level later, that's also good. Thanks for picking up the loose ends <3
  22. Christian Kuhn commented on patch set 11 01/29/22, 17:34

    Reply

    i'm pretty sure we can raise to level 5 relatively soon - stefan and me will push a couple of dedicated patches to reduce current baseline, then we'll quickly raise to level 5.
  23. Stefan Bürk voted on patch set 11 V +1 01/29/22, 17:34

  24. Christian Kuhn voted on patch set 11 V +2 CR +2 01/29/22, 18:45

  25. Christian Kuhn merged patch set 12 01/29/22, 18:46