Review 11.5 Merged

73198[TASK] Revamp phpstan config and handling

Christian Kuhn CR +2 V +2 Impossible +10505 −834 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
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 24

Review log 810

  1. Christian Kuhn uploaded patch set 1 01/29/22, 16:47

  2. Christian Kuhn uploaded patch set 2 01/29/22, 16:57

  3. Christian Kuhn updated the commit message in patch set 3 01/29/22, 16:59

  4. Christian Kuhn uploaded patch set 4 01/29/22, 17:10

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

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

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

  8. Stefan Bürk voted on patch set 4 V +1 01/29/22, 17:35

  9. Christian Kuhn voted on patch set 4 V +2 CR +2 01/29/22, 18:46

  10. Christian Kuhn merged patch set 5 01/29/22, 18:46