1
0
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:
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

@@ -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],

View File

@@ -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);
}
}

View File

@@ -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();

View File

@@ -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],

View File

@@ -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) {

View File

@@ -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));
}
/**

View File

@@ -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]);
}
}