diff --git a/src/RobotLoader/RobotLoader.php b/src/RobotLoader/RobotLoader.php index ef6d5dc..d214e07 100644 --- a/src/RobotLoader/RobotLoader.php +++ b/src/RobotLoader/RobotLoader.php @@ -253,20 +253,19 @@ private function refreshClasses(): void private function createFileIterator(string $dir): Nette\Utils\Finder { if (!is_dir($dir)) { - throw new Nette\IOException(sprintf("File or directory '%s' not found.", $dir)); + throw new Nette\IOException(sprintf("Directory '%s' not found.", $dir)); } $dir = realpath($dir) ?: $dir; // realpath does not work in phar $disallow = []; foreach (array_merge($this->ignoreDirs, $this->excludeDirs) as $item) { if ($item = realpath($item)) { - $disallow[FileSystem::unixSlashes($item)] = true; + $disallow[$item] = true; } } return Nette\Utils\Finder::findFiles($this->acceptFiles) - ->filter($filter = fn(SplFileInfo $file) => $file->getRealPath() === false - || !isset($disallow[FileSystem::unixSlashes($file->getRealPath())])) + ->filter($filter = fn(SplFileInfo $file) => $file->getRealPath() === false || !isset($disallow[$file->getRealPath()])) ->descentFilter($filter) ->from($dir) ->exclude($this->ignoreDirs); @@ -286,7 +285,7 @@ private function updateFile(string $file): void foreach ($foundClasses as $class) { [$prevFile, $prevMtime] = $this->classes[$class] ?? null; - if (isset($prevFile) && @filemtime($prevFile) !== $prevMtime) { // @ file may not exists + if (isset($prevFile) && @filemtime($prevFile) !== $prevMtime) { // @ file may not exist $this->updateFile($prevFile); [$prevFile] = $this->classes[$class] ?? null; } diff --git a/tests/Loaders/RobotLoader.phar.phpt b/tests/Loaders/RobotLoader.phar.phpt index 804a46d..bfba175 100644 --- a/tests/Loaders/RobotLoader.phar.phpt +++ b/tests/Loaders/RobotLoader.phar.phpt @@ -48,7 +48,7 @@ $loader->addDirectory("phar://$pharFile/non-dir"); Assert::exception( fn() => $loader->rebuild(), Nette\IOException::class, - "File or directory 'phar://$pharFile/non-dir' not found.", + "Directory 'phar://$pharFile/non-dir' not found.", ); @@ -58,5 +58,5 @@ $loader->addDirectory("phar://$pharFile/non-file.php"); Assert::exception( fn() => $loader->rebuild(), Nette\IOException::class, - "File or directory 'phar://$pharFile/non-file.php' not found.", + "Directory 'phar://$pharFile/non-file.php' not found.", );