From 1b5d965715e580e0cca1021346c1b6fe764f96a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Tue, 8 Sep 2026 21:57:37 +0200 Subject: [PATCH] Stop importing the php82 polyfill in DefaultSchemaFilesProviderTest PHPStan dies on PHP 7.4 before reporting anything, so every PR against this branch fails the "Tests (7.4)" job regardless of its contents: Child process error (exit code 255): PHP Fatal error: Cannot redeclare Ibexa\PolyfillPhp82\iterator_to_array() ... while running parallel worker ibexa/polyfill-php82 v1.0.1 lists src/iterator_to_array.php in *both* autoload.files and autoload.psr-4 ("Ibexa\PolyfillPhp82\" => "src/"), and the function carries no function_exists() guard. Analysing the `use function Ibexa\PolyfillPhp82\iterator_to_array;` in this test makes PHPStan probe for a class of that name; PSR-4 resolves it to the same file that autoload.files already loaded, and including it a second time is fatal. The polyfill isn't needed here anyway: getSchemaFiles() is a generator, so it's always Traversable and the native iterator_to_array() accepts it on every supported version. Asserting that first keeps level 8 happy about the declared `iterable` return type. This was the only usage in the repo. The underlying autoload overlap is worth fixing in ibexa/polyfill-php82 -- any package importing this function hits the same wall on 7.4 -- but that shouldn't keep this branch red meanwhile. --- .../Bootstrapper/DefaultSchemaFilesProviderTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/contracts/Bootstrapper/DefaultSchemaFilesProviderTest.php b/tests/contracts/Bootstrapper/DefaultSchemaFilesProviderTest.php index 02b8fa8..4d8281e 100644 --- a/tests/contracts/Bootstrapper/DefaultSchemaFilesProviderTest.php +++ b/tests/contracts/Bootstrapper/DefaultSchemaFilesProviderTest.php @@ -9,9 +9,9 @@ namespace Ibexa\Tests\Contracts\Test\Core\Bootstrapper; use Ibexa\Contracts\Test\Core\Bootstrapper\DefaultSchemaFilesProvider; -use function Ibexa\PolyfillPhp82\iterator_to_array; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpKernel\KernelInterface; +use Traversable; /** * @covers \Ibexa\Contracts\Test\Core\Bootstrapper\DefaultSchemaFilesProvider @@ -28,6 +28,8 @@ public function testYieldsSchemaFileResolvedThroughTheKernel(): void $provider = new DefaultSchemaFilesProvider($kernel); - self::assertSame(['/resolved/path/schema.yaml'], iterator_to_array($provider->getSchemaFiles())); + $schemaFiles = $provider->getSchemaFiles(); + self::assertInstanceOf(Traversable::class, $schemaFiles); + self::assertSame(['/resolved/path/schema.yaml'], iterator_to_array($schemaFiles)); } }