From 7972f8b340816e85998cdb6b674ebd1830c8e11a Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Wed, 2 Sep 2026 15:06:28 +0200 Subject: [PATCH] Strip expected directory prefix with substr PHPStan reported: src/AssertDirectory.php:55 Parameter #1 $separator of function explode expects non-empty-string, string given. Splitting on $expected was an indirect way to cut the prefix off the iterated pathname. Since $expected is always that prefix, substr says so directly and drops the non-empty-string requirement. --- src/AssertDirectory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AssertDirectory.php b/src/AssertDirectory.php index 3c97866..a4329e8 100644 --- a/src/AssertDirectory.php +++ b/src/AssertDirectory.php @@ -52,7 +52,7 @@ private static function assertDirectoryContainsContents(string $expected, string foreach ($iterator as $fileInfo) { assert($fileInfo instanceof \SplFileInfo); $expectedPathname = $fileInfo->getPathname(); - $actualPathname = $actual . explode($expected, $expectedPathname, 2)[1]; + $actualPathname = $actual . substr($expectedPathname, strlen($expected)); if ($fileInfo->isDir()) { Assert::assertDirectoryExists($actualPathname, $message);