Skip to content

Commit caa4ac8

Browse files
authored
fix(tests): re-narrow $GLOBALS['TCA'] for PHPStan 2.2.6 (#526)
## Problem CI on `main` is red on all PHPStan matrix cells: ``` Tests/Functional/Service/Tool/GetFlexFormSchemaToolTest.php:57 Cannot access offset 'tx_demo_flex' on mixed. ``` PHPStan 2.2.6 (released 2026-07-26, picked up because the extension does not commit `composer.lock`) no longer carries the `self::assertIsArray($GLOBALS['TCA'])` narrowing across the intervening `$singleDs` statement, so `$GLOBALS['TCA']` is `mixed` again by line 57 and the offset write fails. ## Fix Re-narrow with a native `\assert(is_array($GLOBALS['TCA']))` directly before the write — the project convention for array narrowing (see `Tests/CLAUDE.md`). ## Verification `./Build/Scripts/runTests.sh -s phpstan` locally (PHP 8.5): `[OK] No errors`.
2 parents ef853e6 + ca63ba0 commit caa4ac8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Tests/Functional/Service/Tool/GetFlexFormSchemaToolTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ protected function setUp(): void
5454
$singleDs = (new Typo3Version())->getMajorVersion() >= 14
5555
? self::DS
5656
: ['default' => self::DS];
57+
// Re-narrow here: the assertIsArray() above does not carry across the
58+
// intervening statement, so $GLOBALS['TCA'] is mixed again by this line.
59+
\assert(is_array($GLOBALS['TCA']));
5760
$GLOBALS['TCA']['tx_demo_flex'] = [
5861
'ctrl' => ['title' => 'Demo Flex'],
5962
'columns' => [

0 commit comments

Comments
 (0)