fix(ci): restore compiled project scanning

master
韩天峰 3 weeks ago
parent 26f6c34b7a
commit a3d63e673e
  1. 6
      phpunit/src/CompilerProjectConfigurationTest.php
  2. 8
      src/Build/FileScanner.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);
}
}

@ -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),
);
}

Loading…
Cancel
Save