Skip to content

Commit

Permalink
[9.x] Allows shouldIgnoresDeprecationError() to be overriden (#45299)
Browse files Browse the repository at this point in the history
* Allows `shouldIgnoresDeprecationError()` to be overriden

* wip

* wip

* wip

* Update HandleExceptions.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
crynobone and taylorotwell committed Dec 14, 2022
1 parent 7469819 commit 2c69244
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ public function handleDeprecation($message, $file, $line)
*/
public function handleDeprecationError($message, $file, $line, $level = E_DEPRECATED)
{
if (! class_exists(LogManager::class)
|| ! static::$app->hasBeenBootstrapped()
|| static::$app->runningUnitTests()
) {
if ($this->shouldIgnoreDeprecationErrors()) {
return;
}

Expand All @@ -130,6 +127,18 @@ public function handleDeprecationError($message, $file, $line, $level = E_DEPREC
});
}

/**
* Determine if deprecation errors should be ignored.
*
* @return bool
*/
protected function shouldIgnoreDeprecationErrors()
{
return ! class_exists(LogManager::class)
|| ! static::$app->hasBeenBootstrapped()
|| static::$app->runningUnitTests();
}

/**
* Ensure the "deprecations" logger is configured.
*
Expand Down

0 comments on commit 2c69244

Please sign in to comment.