Skip to content

Commit 4ee4b5d

Browse files
committed
More usage of ArrayLookup
1 parent c63d1e6 commit 4ee4b5d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/HeroTrait.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace ErrorHeroModule;
66

7+
use ArrayLookup\AtLeast;
78
use ErrorException;
89
use ErrorHeroModule\Command\BaseLoggingCommand;
910
use ErrorHeroModule\Listener\Mvc;
@@ -123,18 +124,16 @@ public function phpErrorHandler(int $errorType, string $errorMessage, string $er
123124
return;
124125
}
125126

126-
foreach ($this->errorHeroModuleConfig['display-settings']['exclude-php-errors'] as $excludePhpError) {
127-
if ($errorType === $excludePhpError) {
128-
return;
129-
}
130-
131-
if (
127+
$filter = static fn (mixed $excludePhpError): bool =>
128+
$errorType === $excludePhpError ||
129+
(
132130
is_array($excludePhpError)
133131
&& $excludePhpError[0] === $errorType
134132
&& $excludePhpError[1] === $errorMessage
135-
) {
136-
return;
137-
}
133+
);
134+
135+
if (AtLeast::once($this->errorHeroModuleConfig['display-settings']['exclude-php-errors'], $filter)) {
136+
return;
138137
}
139138

140139
throw new ErrorException($errorMessage, 0, $errorType, $errorFile, $errorLine);

0 commit comments

Comments
 (0)