Skip to content

[TASK] Run PHPStan on every PHP version of the CI matrix - #760

Open
CybotTM wants to merge 1 commit into
TYPO3:mainfrom
CybotTM:task/ci-phpstan-all-php
Open

CybotTM wants to merge 1 commit into
TYPO3:mainfrom
CybotTM:task/ci-phpstan-all-php

Conversation

@CybotTM

@CybotTM CybotTM commented Nov 15, 2026 •

Copy link
Copy Markdown

PHPStan now runs on every PHP version of the CI matrix. This includes PHP 8.5, the only cell that installs TYPO3 v15. The ignore entry for the method_exists() check on Bootstrap::loadExtTables() moves from the baseline to phpstan.neon with reportUnmatched: false, because the method exists in TYPO3 v14.3 only.

Resolves #759

How to reproduce and test

On main, Build/Scripts/runTests.sh -p 8.5 -s composerUpdate && Build/Scripts/runTests.sh -p 8.5 -s phpstan reports one error: the baseline entry for that check in Classes/Core/Testbase.php is unmatched (ignore.unmatched). PHP 8.2, 8.3 and 8.4 install TYPO3 v14.3, and PHPStan passes there.

Results with this branch, run locally with -b docker:

PHP typo3/cms-core phpstan lint unit
8.2 14.3.x-dev no errors ok 128 tests
8.3 14.3.x-dev no errors ok 128 tests
8.4 14.3.x-dev no errors ok 128 tests
8.5 dev-main no errors ok 128 tests

cgl -n on PHP 8.2 finds 0 of 65 files to fix. Without the new ignoreErrors entry, PHPStan on PHP 8.2 reports the loadExtTables error again, so v14 still needs the entry.

The change touches the CI workflow, the PHPStan configuration and one code comment. It does not change code that runs, so the TYPO3 Core test suites are not affected.

Why not an inline ignore comment

An inline // @phpstan-ignore function.alreadyNarrowedType above the check has the same problem as the baseline entry. With v14 it passes. With v15 PHPStan reports "No error with identifier function.alreadyNarrowedType is reported on line 938." Only the global option reportUnmatchedIgnoredErrors: false would silence that, and it would do so for every ignore in the project. The entry in phpstan.neon turns off the unmatched report for this one entry only. A comment at the check points to it.

Why CGL keeps its condition

CGL still runs on PHP 8.3 and lower only. Its result does not depend on the installed packages. php-cs-fixer itself recommends the lowest supported PHP version: "It is recommended to run PHP CS Fixer on PHP 8.2". On PHP 8.4 and 8.5 it also finds 0 files to fix.

PHPStan ran on PHP 8.2 and 8.3 only. PHP 8.5 is the only matrix cell
that installs TYPO3 v15, so CI did not analyse the code against v15.
With v15, PHPStan reports the baseline entry for the method_exists()
check on Bootstrap::loadExtTables() as unmatched. The method exists
in TYPO3 v14.3 only.

Move the entry from the baseline to phpstan.neon and set
reportUnmatched: false. With v14 the entry suppresses the error, and
with v15 PHPStan does not report the unused entry. Remove the PHP
version condition of the PHPStan step. A comment in
Testbase::loadExtensionTables() points to the entry.

An inline @PHPStan-Ignore comment does not work here: with v15,
PHPStan reports it as unmatched as well.

Resolves: TYPO3#759
Releases: main
Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
@CybotTM
CybotTM force-pushed the task/ci-phpstan-all-php branch from 111c151 to 61ad152 Compare November 15, 2026 08:48
@CybotTM
CybotTM marked this pull request as ready for review November 15, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI skips PHPStan on PHP 8.5, the only cell running against TYPO3 v15

2 participants