From a3d63e673e9d44cbaabc3b7000f165027b304724 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Mon, 21 Sep 2026 17:29:59 +0800 Subject: [PATCH] fix(ci): restore compiled project scanning --- phpunit/src/CompilerProjectConfigurationTest.php | 6 ++++-- src/Build/FileScanner.php | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/phpunit/src/CompilerProjectConfigurationTest.php b/phpunit/src/CompilerProjectConfigurationTest.php index 98cd8b9d..81e8620d 100644 --- a/phpunit/src/CompilerProjectConfigurationTest.php +++ b/phpunit/src/CompilerProjectConfigurationTest.php @@ -7,7 +7,7 @@ use TypePhp\Config\ProjectYamlLoader; final class CompilerProjectConfigurationTest extends TestCase { - public function testOnlyReleaseCompilerEmbedsComposerRuntime(): void + public function testReleaseCompilerUsesProductionSettings(): void { $root = dirname(__DIR__, 2); $loader = new ProjectYamlLoader( @@ -18,9 +18,11 @@ final class CompilerProjectConfigurationTest extends TestCase $release = $loader->load($root . '/project-release.yml'); $this->assertArrayNotHasKey('embedded-files', $development); + $this->assertArrayNotHasKey('optimize', $development); $this->assertSame(['./vendor'], $release['embedded-files'] ?? null); + $this->assertSame(2, $release['optimize'] ?? null); - unset($release['embedded-files']); + unset($release['embedded-files'], $release['optimize']); $this->assertSame($development, $release); } } diff --git a/src/Build/FileScanner.php b/src/Build/FileScanner.php index 05415370..54661ef1 100644 --- a/src/Build/FileScanner.php +++ b/src/Build/FileScanner.php @@ -127,9 +127,15 @@ class FileScanner \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS, ); + // SPL passes the current entry, key, and inner iterator. Keep the full + // signature because compiled callbacks validate their argument count. return new \RecursiveCallbackFilterIterator( $iterator, - fn(\SplFileInfo $entry): bool => !$this->closesLoop($entry), + fn( + \SplFileInfo $entry, + mixed $_key, + mixed $_iterator, + ): bool => !$this->closesLoop($entry), ); }