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

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 22