diff --git a/src/RobotLoader/RobotLoader.php b/src/RobotLoader/RobotLoader.php index 2bbbe06..9fa4257 100644 --- a/src/RobotLoader/RobotLoader.php +++ b/src/RobotLoader/RobotLoader.php @@ -78,7 +78,7 @@ public function __destruct() */ public function register(bool $prepend = false): static { - spl_autoload_register([$this, 'tryLoad'], true, $prepend); + spl_autoload_register([$this, 'tryLoad'], prepend: $prepend); return $this; } @@ -475,7 +475,7 @@ private function saveCache($lock = null): void } if (function_exists('opcache_invalidate')) { - @opcache_invalidate($file, true); // @ can be restricted + @opcache_invalidate($file, force: true); // @ can be restricted } } diff --git a/tests/Loaders/RobotLoader.phar.phpt b/tests/Loaders/RobotLoader.phar.phpt index 4d5b18e..804a46d 100644 --- a/tests/Loaders/RobotLoader.phar.phpt +++ b/tests/Loaders/RobotLoader.phar.phpt @@ -45,14 +45,18 @@ Assert::true(class_exists('D')); $loader = new RobotLoader; $loader->setTempDirectory(getTempDir()); $loader->addDirectory("phar://$pharFile/non-dir"); -Assert::exception(function () use ($loader) { - $loader->rebuild(); -}, Nette\IOException::class, "File or directory 'phar://$pharFile/non-dir' not found."); +Assert::exception( + fn() => $loader->rebuild(), + Nette\IOException::class, + "File or directory 'phar://$pharFile/non-dir' not found.", +); $loader = new RobotLoader; $loader->setTempDirectory(getTempDir()); $loader->addDirectory("phar://$pharFile/non-file.php"); -Assert::exception(function () use ($loader) { - $loader->rebuild(); -}, Nette\IOException::class, "File or directory 'phar://$pharFile/non-file.php' not found."); +Assert::exception( + fn() => $loader->rebuild(), + Nette\IOException::class, + "File or directory 'phar://$pharFile/non-file.php' not found.", +);