mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-21 16:46:11 +02:00
Use fully-qualified name for native functions (#1887)
This commit is contained in:
@@ -63,7 +63,7 @@ class GitProcessor implements ProcessorInterface
|
||||
}
|
||||
|
||||
$branches = shell_exec('git branch -v --no-abbrev');
|
||||
if (is_string($branches) && 1 === preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) {
|
||||
if (\is_string($branches) && 1 === preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) {
|
||||
return self::$cache = [
|
||||
'branch' => $matches[1],
|
||||
'commit' => $matches[2],
|
||||
|
@@ -82,7 +82,7 @@ class IntrospectionProcessor implements ProcessorInterface
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
} elseif (in_array($trace[$i]['function'], self::SKIP_FUNCTIONS, true)) {
|
||||
} elseif (\in_array($trace[$i]['function'], self::SKIP_FUNCTIONS, true)) {
|
||||
$i++;
|
||||
|
||||
continue;
|
||||
@@ -117,6 +117,6 @@ class IntrospectionProcessor implements ProcessorInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($trace[$index]['class']) || in_array($trace[$index]['function'], self::SKIP_FUNCTIONS, true);
|
||||
return isset($trace[$index]['class']) || \in_array($trace[$index]['function'], self::SKIP_FUNCTIONS, true);
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ class LoadAverageProcessor implements ProcessorInterface
|
||||
*/
|
||||
public function __construct(int $avgSystemLoad = self::LOAD_1_MINUTE)
|
||||
{
|
||||
if (!in_array($avgSystemLoad, self::AVAILABLE_LOAD, true)) {
|
||||
if (!\in_array($avgSystemLoad, self::AVAILABLE_LOAD, true)) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid average system load: `%s`', $avgSystemLoad));
|
||||
}
|
||||
$this->avgSystemLoad = $avgSystemLoad;
|
||||
@@ -51,7 +51,7 @@ class LoadAverageProcessor implements ProcessorInterface
|
||||
*/
|
||||
public function __invoke(LogRecord $record): LogRecord
|
||||
{
|
||||
if (!function_exists('sys_getloadavg')) {
|
||||
if (!\function_exists('sys_getloadavg')) {
|
||||
return $record;
|
||||
}
|
||||
$usage = sys_getloadavg();
|
||||
|
@@ -63,7 +63,7 @@ class MercurialProcessor implements ProcessorInterface
|
||||
|
||||
$result = explode(' ', trim((string) shell_exec('hg id -nb')));
|
||||
|
||||
if (count($result) >= 3) {
|
||||
if (\count($result) >= 3) {
|
||||
return self::$cache = [
|
||||
'branch' => $result[1],
|
||||
'revision' => $result[2],
|
||||
|
@@ -57,7 +57,7 @@ class PsrLogMessageProcessor implements ProcessorInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
if (null === $val || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
|
||||
if (null === $val || \is_scalar($val) || (\is_object($val) && method_exists($val, "__toString"))) {
|
||||
$replacements[$placeholder] = $val;
|
||||
} elseif ($val instanceof \DateTimeInterface) {
|
||||
if (null === $this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) {
|
||||
@@ -69,12 +69,12 @@ class PsrLogMessageProcessor implements ProcessorInterface
|
||||
}
|
||||
} elseif ($val instanceof \UnitEnum) {
|
||||
$replacements[$placeholder] = $val instanceof \BackedEnum ? $val->value : $val->name;
|
||||
} elseif (is_object($val)) {
|
||||
} elseif (\is_object($val)) {
|
||||
$replacements[$placeholder] = '[object '.Utils::getClass($val).']';
|
||||
} elseif (is_array($val)) {
|
||||
} elseif (\is_array($val)) {
|
||||
$replacements[$placeholder] = 'array'.Utils::jsonEncode($val, null, true);
|
||||
} else {
|
||||
$replacements[$placeholder] = '['.gettype($val).']';
|
||||
$replacements[$placeholder] = '['.\gettype($val).']';
|
||||
}
|
||||
|
||||
if ($this->removeUsedContextFields) {
|
||||
|
@@ -53,7 +53,7 @@ class UidProcessor implements ProcessorInterface, ResettableInterface
|
||||
|
||||
public function reset(): void
|
||||
{
|
||||
$this->uid = $this->generateUid(strlen($this->uid));
|
||||
$this->uid = $this->generateUid(\strlen($this->uid));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -65,7 +65,7 @@ class WebProcessor implements ProcessorInterface
|
||||
}
|
||||
if (isset($extraFields[0])) {
|
||||
foreach (array_keys($this->extraFields) as $fieldName) {
|
||||
if (!in_array($fieldName, $extraFields, true)) {
|
||||
if (!\in_array($fieldName, $extraFields, true)) {
|
||||
unset($this->extraFields[$fieldName]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user