Skip to content

Commit 98a95e9

Browse files
committed
minor #47470 CS fixes (nicolas-grekas)
This PR was merged into the 6.2 branch. Discussion ---------- CS fixes | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 46a66956ca CS fixes
2 parents 9abc061 + 29c7d24 commit 98a95e9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Log/Logger.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ public function __construct(string $minLevel = null, $output = null, callable $f
4848
$minLevel = null === $output || 'php://stdout' === $output || 'php://stderr' === $output ? LogLevel::ERROR : LogLevel::WARNING;
4949

5050
if (isset($_ENV['SHELL_VERBOSITY']) || isset($_SERVER['SHELL_VERBOSITY'])) {
51-
switch ((int) ($_ENV['SHELL_VERBOSITY'] ?? $_SERVER['SHELL_VERBOSITY'])) {
52-
case -1: $minLevel = LogLevel::ERROR; break;
53-
case 1: $minLevel = LogLevel::NOTICE; break;
54-
case 2: $minLevel = LogLevel::INFO; break;
55-
case 3: $minLevel = LogLevel::DEBUG; break;
56-
}
51+
$minLevel = match ((int) ($_ENV['SHELL_VERBOSITY'] ?? $_SERVER['SHELL_VERBOSITY'])) {
52+
-1 => LogLevel::ERROR,
53+
1 => LogLevel::NOTICE,
54+
2 => LogLevel::INFO,
55+
3 => LogLevel::DEBUG,
56+
default => $minLevel,
57+
};
5758
}
5859
}
5960

@@ -96,7 +97,7 @@ private function format(string $level, string $message, array $context, bool $pr
9697
} elseif ($val instanceof \DateTimeInterface) {
9798
$replacements["{{$key}}"] = $val->format(\DateTime::RFC3339);
9899
} elseif (\is_object($val)) {
99-
$replacements["{{$key}}"] = '[object '.\get_class($val).']';
100+
$replacements["{{$key}}"] = '[object '.$val::class.']';
100101
} else {
101102
$replacements["{{$key}}"] = '['.\gettype($val).']';
102103
}

0 commit comments

Comments
 (0)