Skip to content

Commit b0ff45e

Browse files
CS fixes
1 parent 9d14621 commit b0ff45e

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

Command/ServerLogCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
106106
}
107107

108108
if (!$socket = stream_socket_server($host, $errno, $errstr)) {
109-
throw new RuntimeException(sprintf('Server start failed on "%s": ', $host).$errstr.' '.$errno);
109+
throw new RuntimeException(\sprintf('Server start failed on "%s": ', $host).$errstr.' '.$errno);
110110
}
111111

112112
foreach ($this->getLogs($socket) as $clientId => $message) {
@@ -155,7 +155,7 @@ private function displayLog(OutputInterface $output, int $clientId, array $recor
155155
if (isset($record['log_id'])) {
156156
$clientId = unpack('H*', $record['log_id'])[1];
157157
}
158-
$logBlock = sprintf('<bg=%s> </>', self::BG_COLOR[$clientId % 8]);
158+
$logBlock = \sprintf('<bg=%s> </>', self::BG_COLOR[$clientId % 8]);
159159
$output->write($logBlock);
160160

161161
if (Logger::API >= 3) {

Formatter/ConsoleFormatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ private function doFormat(array|LogRecord $record): mixed
123123
'%datetime%' => $record['datetime'] instanceof \DateTimeInterface
124124
? $record['datetime']->format($this->options['date_format'])
125125
: $record['datetime'],
126-
'%start_tag%' => sprintf('<%s>', self::LEVEL_COLOR_MAP[$record['level']]),
127-
'%level_name%' => sprintf($this->options['level_name_format'], $record['level_name']),
126+
'%start_tag%' => \sprintf('<%s>', self::LEVEL_COLOR_MAP[$record['level']]),
127+
'%level_name%' => \sprintf($this->options['level_name_format'], $record['level_name']),
128128
'%end_tag%' => '</>',
129129
'%channel%' => $record['channel'],
130130
'%message%' => $this->replacePlaceHolder($record)['message'],
@@ -177,7 +177,7 @@ private function replacePlaceHolder(array $record): array
177177
// Remove quotes added by the dumper around string.
178178
$v = trim($this->dumpData($v, false), '"');
179179
$v = OutputFormatter::escape($v);
180-
$replacements['{'.$k.'}'] = sprintf('<comment>%s</>', $v);
180+
$replacements['{'.$k.'}'] = \sprintf('<comment>%s</>', $v);
181181
}
182182

183183
$record['message'] = strtr($message, $replacements);

Handler/ElasticsearchLogstashHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class ElasticsearchLogstashHandler extends AbstractHandler
6464
public function __construct(string $endpoint = 'http://127.0.0.1:9200', string $index = 'monolog', ?HttpClientInterface $client = null, string|int|Level $level = Logger::DEBUG, bool $bubble = true, string $elasticsearchVersion = '1.0.0')
6565
{
6666
if (!interface_exists(HttpClientInterface::class)) {
67-
throw new \LogicException(sprintf('The "%s" handler needs an HTTP client. Try running "composer require symfony/http-client".', __CLASS__));
67+
throw new \LogicException(\sprintf('The "%s" handler needs an HTTP client. Try running "composer require symfony/http-client".', __CLASS__));
6868
}
6969

7070
parent::__construct($level, $bubble);
@@ -182,7 +182,7 @@ private function wait(bool $blocking): void
182182
}
183183
} catch (ExceptionInterface $e) {
184184
$this->responses->detach($response);
185-
error_log(sprintf("Could not push logs to Elasticsearch:\n%s", (string) $e));
185+
error_log(\sprintf("Could not push logs to Elasticsearch:\n%s", (string) $e));
186186
}
187187
}
188188
}

Handler/FingersCrossed/NotFoundActivationStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class NotFoundActivationStrategy implements ActivationStrategyInterface
3030
public function __construct(
3131
private RequestStack $requestStack,
3232
array $excludedUrls,
33-
private ActivationStrategyInterface $inner
33+
private ActivationStrategyInterface $inner,
3434
) {
3535
$this->exclude = '{('.implode('|', $excludedUrls).')}i';
3636
}

Handler/MailerHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected function buildMessage(string $content, array $records): Email
108108
} elseif (\is_callable($this->messageTemplate)) {
109109
$message = ($this->messageTemplate)($content, $records);
110110
if (!$message instanceof Email) {
111-
throw new \InvalidArgumentException(sprintf('Could not resolve message from a callable. Instance of "%s" is expected.', Email::class));
111+
throw new \InvalidArgumentException(\sprintf('Could not resolve message from a callable. Instance of "%s" is expected.', Email::class));
112112
}
113113
} else {
114114
throw new \InvalidArgumentException('Could not resolve message as instance of Email or a callable returning it.');

Tests/Formatter/ConsoleFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function providerFormatTests(): array
3535
$tests = [
3636
'record with DateTime object in datetime field' => [
3737
'record' => RecordFactory::create(datetime: $currentDateTime),
38-
'expectedMessage' => sprintf(
38+
'expectedMessage' => \sprintf(
3939
"%s <fg=cyan>WARNING </> <comment>[test]</> test\n",
4040
$currentDateTime->format(ConsoleFormatter::SIMPLE_DATE)
4141
),

Tests/Handler/ConsoleHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function testVerbosityMapping($verbosity, $level, $isHandling, array $map
6363

6464
// check that the handler actually outputs the record if it handles it
6565
$levelName = Logger::getLevelName($level);
66-
$levelName = sprintf('%-9s', $levelName);
66+
$levelName = \sprintf('%-9s', $levelName);
6767

6868
$realOutput = $this->getMockBuilder(Output::class)->onlyMethods(['doWrite'])->getMock();
6969
$realOutput->setVerbosity($verbosity);

Tests/Handler/ServerLogHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testWritingAndFormatting()
5858
$infoRecord = RecordFactory::create(Logger::INFO, 'My info message', 'app', datetime: new \DateTimeImmutable('2013-05-29 16:21:54'));
5959

6060
$socket = stream_socket_server($host, $errno, $errstr);
61-
$this->assertIsResource($socket, sprintf('Server start failed on "%s": %s %s.', $host, $errstr, $errno));
61+
$this->assertIsResource($socket, \sprintf('Server start failed on "%s": %s %s.', $host, $errstr, $errno));
6262

6363
$this->assertTrue($handler->handle($infoRecord), 'The handler finished handling the log as bubble is false.');
6464

0 commit comments

Comments
 (0)