Skip to content

Commit c23cc01

Browse files
Merge pull request #630 from spatie/feature/configurable-error-levels
Add support for configureable error levels
2 parents ca5b60b + 02ca795 commit c23cc01

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

phpstan-baseline.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ parameters:
1515
count: 1
1616
path: src/ErrorPage/Renderer.php
1717

18+
-
19+
message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int\\)\\: bool\\)\\|null, array\\{\\$this\\(Spatie\\\\Ignition\\\\Ignition\\), 'renderError'\\} given\\.$#"
20+
count: 2
21+
path: src/Ignition.php
22+
23+
-
24+
message: "#^Parameter \\#1 \\$callback of function set_exception_handler expects \\(callable\\(Throwable\\)\\: void\\)\\|null, array\\{\\$this\\(Spatie\\\\Ignition\\\\Ignition\\), 'handleException'\\} given\\.$#"
25+
count: 1
26+
path: src/Ignition.php
27+
1828
-
1929
message: "#^Method Spatie\\\\Ignition\\\\Solutions\\\\OpenAi\\\\DummyCache\\:\\:setMultiple\\(\\) has parameter \\$values with no value type specified in iterable type iterable\\.$#"
2030
count: 1

src/Ignition.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,14 @@ public function reset(): self
238238
return $this;
239239
}
240240

241-
public function register(): self
241+
public function register(?int $errorLevels = null): self
242242
{
243-
error_reporting(-1);
243+
error_reporting($errorLevels ?? -1);
244244

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

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

251251
return $this;

0 commit comments

Comments
 (0)