1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-24 18:16:10 +02:00

Use fully-qualified name for native functions (#1887)

This commit is contained in:
Christoph Dreis
2024-06-28 10:45:25 +02:00
committed by GitHub
parent 4e03d25f6d
commit 3ba77d1d39
90 changed files with 246 additions and 245 deletions

View File

@@ -40,7 +40,7 @@ class NormalizerFormatter implements FormatterInterface
public function __construct(?string $dateFormat = null)
{
$this->dateFormat = null === $dateFormat ? static::SIMPLE_DATE : $dateFormat;
if (!function_exists('json_encode')) {
if (!\function_exists('json_encode')) {
throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s NormalizerFormatter');
}
}
@@ -182,8 +182,8 @@ class NormalizerFormatter implements FormatterInterface
return 'Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization';
}
if (null === $data || is_scalar($data)) {
if (is_float($data)) {
if (null === $data || \is_scalar($data)) {
if (\is_float($data)) {
if (is_infinite($data)) {
return ($data > 0 ? '' : '-') . 'INF';
}
@@ -195,13 +195,13 @@ class NormalizerFormatter implements FormatterInterface
return $data;
}
if (is_array($data)) {
if (\is_array($data)) {
$normalized = [];
$count = 1;
foreach ($data as $key => $value) {
if ($count++ > $this->maxNormalizeItemCount) {
$normalized['...'] = 'Over ' . $this->maxNormalizeItemCount . ' items ('.count($data).' total), aborting normalization';
$normalized['...'] = 'Over ' . $this->maxNormalizeItemCount . ' items ('.\count($data).' total), aborting normalization';
break;
}
@@ -215,7 +215,7 @@ class NormalizerFormatter implements FormatterInterface
return $this->formatDate($data);
}
if (is_object($data)) {
if (\is_object($data)) {
if ($data instanceof Throwable) {
return $this->normalizeException($data, $depth);
}
@@ -244,11 +244,11 @@ class NormalizerFormatter implements FormatterInterface
return [Utils::getClass($data) => $value];
}
if (is_resource($data)) {
if (\is_resource($data)) {
return sprintf('[resource(%s)]', get_resource_type($data));
}
return '[unknown('.gettype($data).')]';
return '[unknown('.\gettype($data).')]';
}
/**
@@ -286,9 +286,9 @@ class NormalizerFormatter implements FormatterInterface
}
if (isset($e->detail)) {
if (is_string($e->detail)) {
if (\is_string($e->detail)) {
$data['detail'] = $e->detail;
} elseif (is_object($e->detail) || is_array($e->detail)) {
} elseif (\is_object($e->detail) || \is_array($e->detail)) {
$data['detail'] = $this->toJson($e->detail, true);
}
}