Skip to content

Commit 45cda74

Browse files
committed
Move faker deprecation check
1 parent 618640f commit 45cda74

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

system/Debug/Exceptions.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ public function exceptionHandler(Throwable $exception)
159159
public function errorHandler(int $severity, string $message, ?string $file = null, ?int $line = null)
160160
{
161161
if ($this->isDeprecationError($severity)) {
162+
// @TODO Remove if Faker is fixed.
163+
if ($this->isFakerDeprecationError($message, $file, $line)) {
164+
return true;
165+
}
166+
162167
if (! $this->config->logDeprecationsOnly || (bool) env('CODEIGNITER_SCREAM_DEPRECATIONS')) {
163168
throw new ErrorException($message, 0, $severity, $file, $line);
164169
}
@@ -167,12 +172,6 @@ public function errorHandler(int $severity, string $message, ?string $file = nul
167172
}
168173

169174
if (error_reporting() & $severity) {
170-
// @TODO Remove if Faker is fixed.
171-
if ($this->isFakerDeprecationError($severity, $message, $file, $line)) {
172-
// Ignore the error.
173-
return true;
174-
}
175-
176175
throw new ErrorException($message, 0, $severity, $file, $line);
177176
}
178177

@@ -184,11 +183,10 @@ public function errorHandler(int $severity, string $message, ?string $file = nul
184183
*
185184
* @see https://github.com/FakerPHP/Faker/issues/479
186185
*/
187-
private function isFakerDeprecationError(int $severity, string $message, ?string $file = null, ?int $line = null)
186+
private function isFakerDeprecationError(string $message, ?string $file = null, ?int $line = null)
188187
{
189188
if (
190-
$severity === E_DEPRECATED
191-
&& strpos($file, VENDORPATH . 'fakerphp/faker/') !== false
189+
strpos($file, VENDORPATH . 'fakerphp/faker/') !== false
192190
&& $message === 'Use of "static" in callables is deprecated'
193191
) {
194192
log_message(

0 commit comments

Comments
 (0)