diff --git a/phpunit/src/CompilerBaseApiTest.php b/phpunit/src/CompilerBaseApiTest.php index 4939ec83..0cffa399 100644 --- a/phpunit/src/CompilerBaseApiTest.php +++ b/phpunit/src/CompilerBaseApiTest.php @@ -576,6 +576,35 @@ YAML); $this->assertNotContains(realpath($projectDir . '/skipped/nested.php'), $files); } + public function testParseProjectYamlAllowsMissingIgnorePaths(): void + { + $projectFile = $this->createProjectFile(<<<'YAML' +sources: + - main.php +ignore: + - optional-missing.php + - optional-missing-directory +YAML); + + $files = $this->invokeMethod('parseProjectYaml', $projectFile); + + $this->assertSame([realpath(dirname($projectFile) . '/main.php')], $files); + $this->assertSame([], $this->getPropertyValue('ignorePaths')); + } + + public function testParseProjectYamlStillRejectsMissingSources(): void + { + $projectFile = $this->createProjectFile(<<<'YAML' +sources: + - required-missing.php +YAML); + + $this->expectException(TestError::class); + $this->expectExceptionMessage('Source file not exists: `required-missing.php`'); + + $this->invokeMethod('parseProjectYaml', $projectFile); + } + public function testParseProjectYamlSupportsConditionalSourcesByPhpVersion(): void { $futureVersion = PHP_VERSION_ID + 10000; diff --git a/src/Translator.php b/src/Translator.php index db4cd0c9..861279a9 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -2230,7 +2230,10 @@ CODE; foreach ($ignore as $src) { $realPath = $this->getAbsolutePath($src, $projectDir); if (!$realPath) { - $this->error('Source file not exists: `' . $src . '`'); + // Ignore entries describe optional exclusions. Projects often + // share one configuration across dependency versions where an + // excluded file or directory may not exist. + continue; } $this->ignorePaths[] = $realPath; } diff --git a/version.txt b/version.txt index ba851d84..8b37c8cf 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1096 +1097 \ No newline at end of file