• Stefan Bürk's avatar
    [TASK] Revamp phpstan config and handling · 997722b8
    Stefan Bürk authored and Christian Kuhn's avatar Christian Kuhn committed
    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.
    
    Resolves: #96675
    Releases: main, 11.5
    Change-Id: I0e7ff7aa796e59a2c5eedde0b673f741f8b87dea
    Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73037
    
    
    Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
    Tested-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
    Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
    Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
    Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
    Reviewed-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
    Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
    997722b8