mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 13:16:39 +02:00
Change out to Throwable
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Monolog\Formatter;
|
namespace Monolog\Formatter;
|
||||||
|
|
||||||
use Exception;
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes incoming records to remove objects/resources so it's easier to dump to various targets
|
* Normalizes incoming records to remove objects/resources so it's easier to dump to various targets
|
||||||
@@ -90,8 +90,7 @@ class NormalizerFormatter implements FormatterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($data)) {
|
if (is_object($data)) {
|
||||||
// TODO 2.0 only check for Throwable
|
if ($data instanceof Throwable)) {
|
||||||
if ($data instanceof Exception || (PHP_VERSION_ID > 70000 && $data instanceof \Throwable)) {
|
|
||||||
return $this->normalizeException($data);
|
return $this->normalizeException($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,9 +114,8 @@ class NormalizerFormatter implements FormatterInterface
|
|||||||
|
|
||||||
protected function normalizeException($e)
|
protected function normalizeException($e)
|
||||||
{
|
{
|
||||||
// TODO 2.0 only check for Throwable
|
if (!$e instanceof Throwable) {
|
||||||
if (!$e instanceof Exception && !$e instanceof \Throwable) {
|
throw new \InvalidArgumentException('Throwable expected, got '.gettype($e).' / '.get_class($e));
|
||||||
throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
|
Reference in New Issue
Block a user