Skip to content

Commit

Permalink
Merge pull request #630 from spatie/feature/configurable-error-levels
Browse files Browse the repository at this point in the history
Add support for configureable error levels
  • Loading branch information
rubenvanassche authored May 3, 2024
2 parents ca5b60b + 02ca795 commit c23cc01
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 10 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ parameters:
count: 1
path: src/ErrorPage/Renderer.php

-
message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int\\)\\: bool\\)\\|null, array\\{\\$this\\(Spatie\\\\Ignition\\\\Ignition\\), 'renderError'\\} given\\.$#"
count: 2
path: src/Ignition.php

-
message: "#^Parameter \\#1 \\$callback of function set_exception_handler expects \\(callable\\(Throwable\\)\\: void\\)\\|null, array\\{\\$this\\(Spatie\\\\Ignition\\\\Ignition\\), 'handleException'\\} given\\.$#"
count: 1
path: src/Ignition.php

-
message: "#^Method Spatie\\\\Ignition\\\\Solutions\\\\OpenAi\\\\DummyCache\\:\\:setMultiple\\(\\) has parameter \\$values with no value type specified in iterable type iterable\\.$#"
count: 1
Expand Down
10 changes: 5 additions & 5 deletions src/Ignition.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,14 @@ public function reset(): self
return $this;
}

public function register(): self
public function register(?int $errorLevels = null): self
{
error_reporting(-1);
error_reporting($errorLevels ?? -1);

/** @phpstan-ignore-next-line */
set_error_handler([$this, 'renderError']);
$errorLevels
? set_error_handler([$this, 'renderError'], $errorLevels)
: set_error_handler([$this, 'renderError']);

/** @phpstan-ignore-next-line */
set_exception_handler([$this, 'handleException']);

return $this;
Expand Down

0 comments on commit c23cc01

Please sign in to comment.