From f4bdcbf1f1d72a24b7456badf6a51760c2776f52 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Fri, 20 Nov 2026 01:57:57 +0800 Subject: [PATCH] fix: make `FrameworkCodeTest` tolerate files removed during the scan --- tests/system/AutoReview/FrameworkCodeTest.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index a1d513e42b9c..ba4caf9f0a48 100644 --- a/tests/system/AutoReview/FrameworkCodeTest.php +++ b/tests/system/AutoReview/FrameworkCodeTest.php @@ -59,7 +59,7 @@ public function testDeprecationsAreProperlyVersioned(): void $deprecationsWithoutVersion = []; foreach ($this->getSourceFiles() as $file) { - $lines = file($file, FILE_IGNORE_NEW_LINES); + $lines = @file($file, FILE_IGNORE_NEW_LINES); if ($lines === false) { continue; @@ -156,6 +156,7 @@ private static function getTestClasses(): array FilesystemIterator::SKIP_DOTS, ), RecursiveIteratorIterator::CHILD_FIRST, + RecursiveIteratorIterator::CATCH_GET_CHILD, ); $testClasses = array_map( @@ -211,12 +212,17 @@ private function getSourceFiles(): array FilesystemIterator::SKIP_DOTS, ), RecursiveIteratorIterator::CHILD_FIRST, + RecursiveIteratorIterator::CATCH_GET_CHILD, ); /** @var SplFileInfo $file */ foreach ($iterator as $file) { if ($file->isFile() && str_ends_with($file->getPathname(), '.php')) { - $phpFiles[] = $file->getRealPath(); + $realPath = $file->getRealPath(); + + if ($realPath !== false) { + $phpFiles[] = $realPath; + } } } }