From 61ad15293764ca8bd634b9c4c16691f859df2fa7 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Sun, 15 Nov 2026 08:38:37 +0100 Subject: [PATCH] [TASK] Run PHPStan on every PHP version of the CI matrix 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: #759 Releases: main Signed-off-by: Sebastian Mendel --- .github/workflows/ci.yml | 1 - Build/phpstan/phpstan-baseline.neon | 6 ------ Build/phpstan/phpstan.neon | 10 ++++++++++ Classes/Core/Testbase.php | 2 ++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8812b772..97856d70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,6 @@ jobs: run: Build/Scripts/runTests.sh -b docker -p ${{ matrix.php }} -s lint - name: Phpstan - if: ${{ matrix.php <= '8.3' }} run: Build/Scripts/runTests.sh -b docker -p ${{ matrix.php }} -s phpstan - name: Unit Tests diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index 208a1a5c..a39ba5db 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -35,9 +35,3 @@ parameters: identifier: notIdentical.alwaysTrue count: 1 path: ../../Classes/Core/Functional/FunctionalTestCase.php - - - - message: '#^Call to function method_exists\(\) with ''TYPO3\\\\CMS\\\\Core\\\\Core\\\\Bootstrap'' and ''loadExtTables'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../Classes/Core/Testbase.php diff --git a/Build/phpstan/phpstan.neon b/Build/phpstan/phpstan.neon index 1f0230a7..62141b2b 100644 --- a/Build/phpstan/phpstan.neon +++ b/Build/phpstan/phpstan.neon @@ -15,6 +15,16 @@ parameters: - ../../Classes - ../../Tests + ignoreErrors: + # Bootstrap::loadExtTables() exists in TYPO3 v14 only. With v14 the check in + # Testbase::loadExtensionTables() is always true, with v15 it is necessary. + # So PHPStan must not report this entry as unmatched. + - + message: '#^Call to function method_exists\(\) with ''TYPO3\\\\CMS\\\\Core\\\\Core\\\\Bootstrap'' and ''loadExtTables'' will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + path: ../../Classes/Core/Testbase.php + reportUnmatched: false + excludePaths: # Text fixtures extensions uses $_EXTKEY phpstan would be report as "might not defined" - ../../Tests/Unit/*/Fixtures/Extensions/*/ext_emconf.php diff --git a/Classes/Core/Testbase.php b/Classes/Core/Testbase.php index 9eb783f9..fd52c0ba 100644 --- a/Classes/Core/Testbase.php +++ b/Classes/Core/Testbase.php @@ -934,6 +934,8 @@ private function truncateAllTablesForOtherDatabases(): void */ public function loadExtensionTables(): void { + // Bootstrap::loadExtTables() exists in TYPO3 v14 only. For PHPStan, + // see the ignoreErrors entry in Build/phpstan/phpstan.neon. if (method_exists(Bootstrap::class, 'loadExtTables')) { Bootstrap::loadExtTables(); }