diff --git a/src/Linter.php b/src/Linter.php index f42ff0e2..18596445 100644 --- a/src/Linter.php +++ b/src/Linter.php @@ -9,7 +9,8 @@ class Linter { - private mixed $processCallback = null; + + private ?\Closure $processCallback = null; private array $files = []; private array $cache = []; private array $paths; @@ -34,8 +35,7 @@ public function lint(array $files = [], bool $cache = true): array $files = $this->getFiles(); } - $processCallback = is_callable($this->processCallback) ? $this->processCallback : function () { - }; + $processCallback = $this->processCallback ?? fn() => null; $errors = []; $running = []; @@ -147,7 +147,7 @@ public function setFiles(array $files): static public function setProcessCallback(callable $processCallback): static { - $this->processCallback = $processCallback; + $this->processCallback = \Closure::fromCallable($processCallback); return $this; }