From bd3a578c154cd5ac44fb879f0f6d9f38fd825056 Mon Sep 17 00:00:00 2001 From: Andi Date: Wed, 19 Aug 2026 19:46:22 +0200 Subject: [PATCH] fix: guard each screenshot directory the way the parent is guarded cleanup() protects the parent with is_dir() and then rmdir()s three children unguarded. Two of them, Sliders and ImageDiffView, belong to the visual-diff features and a plain run never creates them. The @ silences the message, but PHPUnit still records a suppressed diagnostic as a Test-Runner-Triggered PHP Warning, so a suite running with failOnWarning exits non-zero while every test passes. glob() is why the existing guard does not catch it: on a missing directory it answers with an empty array rather than false, so is_array() is true, the unlink loop runs over nothing, and control reaches the rmdir that warns. --- src/Support/Screenshot.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Support/Screenshot.php b/src/Support/Screenshot.php index 57b9e996..a8c39f98 100644 --- a/src/Support/Screenshot.php +++ b/src/Support/Screenshot.php @@ -72,6 +72,10 @@ public static function cleanup(): void self::dir().'/ImageDiffView', self::dir(), ] as $dir) { + if (! is_dir($dir)) { + continue; + } + $files = glob($dir.'/*'); if (is_array($files)) {