Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Sep 26, 2023
1 parent 7d88ff3 commit abc683f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/RobotLoader/RobotLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
}
}

Expand Down
16 changes: 10 additions & 6 deletions tests/Loaders/RobotLoader.phar.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
);

0 comments on commit abc683f

Please sign in to comment.