updated packages
This commit is contained in:
@@ -61,7 +61,7 @@ class FatalErrorException extends \ErrorException
|
||||
unset($frame);
|
||||
$trace = array_reverse($trace);
|
||||
} else {
|
||||
$trace = array();
|
||||
$trace = [];
|
||||
}
|
||||
|
||||
$this->setTrace($trace);
|
||||
|
||||
@@ -33,12 +33,12 @@ class FlattenException
|
||||
private $file;
|
||||
private $line;
|
||||
|
||||
public static function create(\Exception $exception, $statusCode = null, array $headers = array())
|
||||
public static function create(\Exception $exception, $statusCode = null, array $headers = [])
|
||||
{
|
||||
return static::createFromThrowable($exception, $statusCode, $headers);
|
||||
}
|
||||
|
||||
public static function createFromThrowable(\Throwable $exception, ?int $statusCode = null, array $headers = array()): self
|
||||
public static function createFromThrowable(\Throwable $exception, ?int $statusCode = null, array $headers = []): self
|
||||
{
|
||||
$e = new static();
|
||||
$e->setMessage($exception->getMessage());
|
||||
@@ -73,13 +73,13 @@ class FlattenException
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
$exceptions = array();
|
||||
foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
|
||||
$exceptions[] = array(
|
||||
$exceptions = [];
|
||||
foreach (array_merge([$this], $this->getAllPrevious()) as $exception) {
|
||||
$exceptions[] = [
|
||||
'message' => $exception->getMessage(),
|
||||
'class' => $exception->getClass(),
|
||||
'trace' => $exception->getTrace(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $exceptions;
|
||||
@@ -213,7 +213,7 @@ class FlattenException
|
||||
|
||||
public function getAllPrevious()
|
||||
{
|
||||
$exceptions = array();
|
||||
$exceptions = [];
|
||||
$e = $this;
|
||||
while ($e = $e->getPrevious()) {
|
||||
$exceptions[] = $e;
|
||||
@@ -247,8 +247,8 @@ class FlattenException
|
||||
*/
|
||||
public function setTrace($trace, $file, $line)
|
||||
{
|
||||
$this->trace = array();
|
||||
$this->trace[] = array(
|
||||
$this->trace = [];
|
||||
$this->trace[] = [
|
||||
'namespace' => '',
|
||||
'short_class' => '',
|
||||
'class' => '',
|
||||
@@ -256,8 +256,8 @@ class FlattenException
|
||||
'function' => '',
|
||||
'file' => $file,
|
||||
'line' => $line,
|
||||
'args' => array(),
|
||||
);
|
||||
'args' => [],
|
||||
];
|
||||
foreach ($trace as $entry) {
|
||||
$class = '';
|
||||
$namespace = '';
|
||||
@@ -267,7 +267,7 @@ class FlattenException
|
||||
$namespace = implode('\\', $parts);
|
||||
}
|
||||
|
||||
$this->trace[] = array(
|
||||
$this->trace[] = [
|
||||
'namespace' => $namespace,
|
||||
'short_class' => $class,
|
||||
'class' => isset($entry['class']) ? $entry['class'] : '',
|
||||
@@ -275,8 +275,8 @@ class FlattenException
|
||||
'function' => isset($entry['function']) ? $entry['function'] : null,
|
||||
'file' => isset($entry['file']) ? $entry['file'] : null,
|
||||
'line' => isset($entry['line']) ? $entry['line'] : null,
|
||||
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
|
||||
);
|
||||
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [],
|
||||
];
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -284,34 +284,34 @@ class FlattenException
|
||||
|
||||
private function flattenArgs($args, $level = 0, &$count = 0)
|
||||
{
|
||||
$result = array();
|
||||
$result = [];
|
||||
foreach ($args as $key => $value) {
|
||||
if (++$count > 1e4) {
|
||||
return array('array', '*SKIPPED over 10000 entries*');
|
||||
return ['array', '*SKIPPED over 10000 entries*'];
|
||||
}
|
||||
if ($value instanceof \__PHP_Incomplete_Class) {
|
||||
// is_object() returns false on PHP<=7.1
|
||||
$result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
|
||||
$result[$key] = ['incomplete-object', $this->getClassNameFromIncomplete($value)];
|
||||
} elseif (\is_object($value)) {
|
||||
$result[$key] = array('object', \get_class($value));
|
||||
$result[$key] = ['object', \get_class($value)];
|
||||
} elseif (\is_array($value)) {
|
||||
if ($level > 10) {
|
||||
$result[$key] = array('array', '*DEEP NESTED ARRAY*');
|
||||
$result[$key] = ['array', '*DEEP NESTED ARRAY*'];
|
||||
} else {
|
||||
$result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
|
||||
$result[$key] = ['array', $this->flattenArgs($value, $level + 1, $count)];
|
||||
}
|
||||
} elseif (null === $value) {
|
||||
$result[$key] = array('null', null);
|
||||
$result[$key] = ['null', null];
|
||||
} elseif (\is_bool($value)) {
|
||||
$result[$key] = array('boolean', $value);
|
||||
$result[$key] = ['boolean', $value];
|
||||
} elseif (\is_int($value)) {
|
||||
$result[$key] = array('integer', $value);
|
||||
$result[$key] = ['integer', $value];
|
||||
} elseif (\is_float($value)) {
|
||||
$result[$key] = array('float', $value);
|
||||
$result[$key] = ['float', $value];
|
||||
} elseif (\is_resource($value)) {
|
||||
$result[$key] = array('resource', get_resource_type($value));
|
||||
$result[$key] = ['resource', get_resource_type($value)];
|
||||
} else {
|
||||
$result[$key] = array('string', (string) $value);
|
||||
$result[$key] = ['string', (string) $value];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class SilencedErrorContext implements \JsonSerializable
|
||||
private $line;
|
||||
private $trace;
|
||||
|
||||
public function __construct(int $severity, string $file, int $line, array $trace = array(), int $count = 1)
|
||||
public function __construct(int $severity, string $file, int $line, array $trace = [], int $count = 1)
|
||||
{
|
||||
$this->severity = $severity;
|
||||
$this->file = $file;
|
||||
@@ -56,12 +56,12 @@ class SilencedErrorContext implements \JsonSerializable
|
||||
|
||||
public function JsonSerialize()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'severity' => $this->severity,
|
||||
'file' => $this->file,
|
||||
'line' => $this->line,
|
||||
'trace' => $this->trace,
|
||||
'count' => $this->count,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user