Skip to content

Commit 562a780

Browse files
committed
resolve static test issues
1 parent 17a5daf commit 562a780

File tree

9 files changed

+28
-29
lines changed

9 files changed

+28
-29
lines changed

src/App/Logger/Formatter/JsonErrorFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ public function format(\Monolog\LogRecord $record): string
6262
$loggedErrors = $this->reader->read();
6363

6464
if (isset($loggedErrors[$record->context['errorCode']])) {
65-
return '';
65+
return '';
6666
}
67-
return $this->toJson($this->formatLog($record)) . PHP_EOL;
67+
return $this->toJson($this->formatLog($record)) . PHP_EOL;
6868
} catch (\Exception $exception) {
6969
return '';
7070
}

src/App/Logger/Formatter/LineFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function format(\Monolog\LogRecord $record): string
3535
}
3636

3737
if (isset($record->message) && !empty($record->context['suggestion'])) {
38-
// Create new LogRecord from existing and update the message,
38+
// Create new LogRecord from existing and update the message,
3939
// since message is read only
4040
$message = $record->message . PHP_EOL . $record->context['suggestion'];
4141
$record = new \Monolog\LogRecord(

src/App/Logger/Gelf/Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function write(LogRecord $record): void
3434
}
3535
}
3636
} else {
37-
/**
37+
/**
3838
* Wrapper for GelfHandler class.
3939
*/
4040
class Handler extends GelfHandler

src/App/Logger/HandlerFactory.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function create(string $handler): AbstractProcessingHandler
8484
if ($minLevel instanceof Level) {
8585
$minLevel = $minLevel->value;
8686
}
87-
$configuration = $this->logConfig->get($handler);
87+
$configuration = $this->logConfig->get($handler);
8888
} catch (ConfigException $exception) {
8989
throw new LoggerException($exception->getMessage(), $exception->getCode(), $exception);
9090
}
@@ -97,7 +97,7 @@ public function create(string $handler): AbstractProcessingHandler
9797
}
9898

9999
try {
100-
switch ($handler) {
100+
switch ($handler) {
101101
case static::HANDLER_FILE:
102102
$handlerInstance = new StreamHandler(
103103
$configuration->get('file'),
@@ -184,8 +184,7 @@ private function normalizeLevel(string $level): Level|int
184184
if (!$normalizedLevel instanceof Level) {
185185
throw new LoggerException('Logger level is incorrect');
186186
}
187-
}
188-
else {
187+
} else {
189188
if (!is_int($normalizedLevel)) {
190189
throw new LoggerException('Logger level is incorrect');
191190
}

src/App/Logger/Processor/SanitizeProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public function __construct(Sanitizer $sanitizer)
3535
* @return LogRecord
3636
*/
3737
public function __invoke(\Monolog\LogRecord $record)
38-
{
38+
{
3939
$message = $this->sanitizer->sanitize($record->message);
40-
// Create new LogRecord from existing and update the message,
40+
// Create new LogRecord from existing and update the message,
4141
// since message is read only
4242
$record = new \Monolog\LogRecord(
4343
datetime: $record->datetime,

src/Test/Functional/Acceptance/ReportDirNestingLevelCest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\MagentoCloud\Test\Functional\Acceptance;
99

1010
use Magento\MagentoCloud\Config\Stage\BuildInterface;
11+
1112
/**
1213
* This test runs on the latest version of PHP
1314
*

src/Test/Unit/App/Logger/Formatter/JsonErrorFormatterTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,20 @@ public function testFormatEmptyError(): void
8686
->with(11)
8787
->willReturn([]);
8888

89-
if (\Monolog\Logger::API == 3) {
90-
$logRecord = new \Monolog\LogRecord(
91-
datetime: new \DateTimeImmutable(),
92-
channel: 'testChannel',
93-
level: \Monolog\Level::Warning,
94-
message: 'some error',
95-
context: ['errorCode' => 11, 'suggestion' => 'some suggestion']
96-
);
97-
} else {
98-
$logRecord = [
99-
'message' => 'some error',
100-
'context' => ['errorCode' => 11, 'suggestion' => 'some suggestion']
101-
];
102-
}
89+
if (\Monolog\Logger::API == 3) {
90+
$logRecord = new \Monolog\LogRecord(
91+
datetime: new \DateTimeImmutable(),
92+
channel: 'testChannel',
93+
level: \Monolog\Level::Warning,
94+
message: 'some error',
95+
context: ['errorCode' => 11, 'suggestion' => 'some suggestion']
96+
);
97+
} else {
98+
$logRecord = [
99+
'message' => 'some error',
100+
'context' => ['errorCode' => 11, 'suggestion' => 'some suggestion']
101+
];
102+
}
103103

104104
$this->assertEquals(
105105
'{"errorCode":11,"suggestion":"some suggestion","title":"some error"}' . PHP_EOL,

src/Test/Unit/App/Logger/Formatter/LineFormatterTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testFormat(string $expected, array $record)
5252
* @return array
5353
*/
5454
public function formatDataProvider(): array
55-
{
55+
{
5656
if (\Monolog\Logger::API == 3) {
5757
return [
5858
[
@@ -83,8 +83,7 @@ public function formatDataProvider(): array
8383
]
8484
],
8585
];
86-
}
87-
else {
86+
} else {
8887
return [
8988
[
9089
'[%datetime%] WARNING: test' . PHP_EOL,

src/Test/Unit/App/Logger/HandlerFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function testCreate(
144144
/** @var AbstractHandler $handler */
145145
$handler = $this->handlerFactory->create($handlerName);
146146
$level = $handler->getLevel();
147-
if($level instanceof Level) {
147+
if ($level instanceof Level) {
148148
$level = $level->value;
149149
}
150150
$this->assertInstanceOf(HandlerInterface::class, $handler);
@@ -278,7 +278,7 @@ public function createDataProvider()
278278
'syslog udp handler' => [
279279
'handler' => HandlerFactory::HANDLER_SYSLOG_UDP,
280280
'repositoryMockReturnMap' => [
281-
['host', null, '127.0.0.1'],
281+
['host', null, '127.0.0.1'],
282282
['port', null, 12201],
283283
['facility', LOG_USER, LOG_USER],
284284
['bubble', true, false],

0 commit comments

Comments
 (0)