Skip to content

Commit

Permalink
Merge pull request #99 from LongTermSupport/BugFix
Browse files Browse the repository at this point in the history
Bug fix on process callback
  • Loading branch information
overtrue authored Jul 8, 2021
2 parents d04fb1a + 2a54e90 commit 0bbdef4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Linter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

class Linter
{
private mixed $processCallback = null;

private ?\Closure $processCallback = null;
private array $files = [];
private array $cache = [];
private array $paths;
Expand All @@ -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 = [];
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 0bbdef4

Please sign in to comment.