Skip to content

Commit 6a4a5ac

Browse files
committed
cs fixer
1 parent 8250519 commit 6a4a5ac

File tree

9 files changed

+47
-39
lines changed

9 files changed

+47
-39
lines changed

src/EventListener/ConsoleListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class ConsoleListener
3636
/**
3737
* Constructor.
3838
*
39-
* @param HubInterface $hub The current hub
40-
* @param bool $captureErrors Whether to capture console errors
39+
* @param HubInterface $hub The current hub
40+
* @param bool $captureErrors Whether to capture console errors
4141
*/
4242
public function __construct(HubInterface $hub, bool $captureErrors = true)
4343
{
@@ -61,7 +61,7 @@ public function handleConsoleCommandEvent(ConsoleCommandEvent $event): void
6161
}
6262

6363
if ($input instanceof ArgvInput) {
64-
$scope->setExtra('Full command', (string)$input);
64+
$scope->setExtra('Full command', (string) $input);
6565
}
6666
}
6767

@@ -84,7 +84,7 @@ public function handleConsoleTerminateEvent(ConsoleTerminateEvent $event): void
8484
public function handleConsoleErrorEvent(ConsoleErrorEvent $event): void
8585
{
8686
$this->hub->configureScope(function (Scope $scope) use ($event): void {
87-
$scope->setTag('console.command.exit_code', (string)$event->getExitCode());
87+
$scope->setTag('console.command.exit_code', (string) $event->getExitCode());
8888

8989
if ($this->captureErrors) {
9090
$hint = EventHint::fromArray([

src/EventListener/LogRequestListener.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sentry\SentryBundle\EventListener;
46

57
use Sentry\Logs\Logs;
@@ -10,16 +12,15 @@
1012
*/
1113
class LogRequestListener
1214
{
13-
1415
/**
1516
* Flushes the logs on kernel termination.
1617
*
1718
* @param TerminateEvent $event
19+
*
1820
* @return void
1921
*/
2022
public function handleKernelTerminateEvent(TerminateEvent $event)
2123
{
2224
Logs::getInstance()->flush();
2325
}
24-
2526
}

src/Monolog/LogsHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function handle(array $record): bool
4242
if ($this->logsHandler->isHandling($record)) {
4343
return $this->logsHandler->handle($record);
4444
}
45+
4546
return false;
4647
}
4748

tests/End2End/App/Command/CrashCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sentry\SentryBundle\Tests\End2End\App\Command;
46

57
use Psr\Log\LoggerInterface;
@@ -10,7 +12,6 @@
1012

1113
class CrashCommand extends Command
1214
{
13-
1415
/**
1516
* @var LoggerInterface
1617
*/
@@ -30,15 +31,14 @@ public function __construct(LoggerInterface $logger, string $subcommand = null)
3031

3132
protected function execute(InputInterface $input, OutputInterface $output)
3233
{
33-
$this->logger->warning("Executing subcommand if exists");
34+
$this->logger->warning('Executing subcommand if exists');
3435

35-
if ($this->subcommand !== null) {
36+
if (null !== $this->subcommand) {
3637
$this->getApplication()->doRun(new ArgvInput(['bin/console', 'log:test']), $output);
3738
}
3839

39-
$this->logger->emergency("About to crash");
40+
$this->logger->emergency('About to crash');
4041

41-
throw new \RuntimeException("Crash in command");
42+
throw new \RuntimeException('Crash in command');
4243
}
43-
4444
}

tests/End2End/App/Command/LoggingCommand.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sentry\SentryBundle\Tests\End2End\App\Command;
46

57
use Psr\Log\LoggerInterface;
@@ -22,13 +24,13 @@ public function __construct(LoggerInterface $logger)
2224

2325
protected function execute(InputInterface $input, OutputInterface $output)
2426
{
25-
$this->logger->debug("Debug Log");
27+
$this->logger->debug('Debug Log');
2628

27-
$this->logger->info("Info Log");
29+
$this->logger->info('Info Log');
2830

29-
$this->logger->warning("Warn Log");
31+
$this->logger->warning('Warn Log');
3032

31-
$this->logger->error("Error Log");
33+
$this->logger->error('Error Log');
3234

3335
return 0;
3436
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sentry\SentryBundle\Tests\End2End\App\Controller;
46

57
use Psr\Log\LoggerInterface;
68
use Symfony\Component\HttpFoundation\Response;
79

810
class LoggingController
911
{
10-
1112
/**
1213
* @var LoggerInterface
1314
*/
@@ -21,26 +22,25 @@ public function __construct(LoggerInterface $logger)
2122
public function justLogging()
2223
{
2324
// LogLevel::fatal()
24-
$this->logger->emergency("Emergency Log");
25-
$this->logger->critical("Critical Log");
25+
$this->logger->emergency('Emergency Log');
26+
$this->logger->critical('Critical Log');
2627
// LogLevel::error()
27-
$this->logger->error("Error Log");
28+
$this->logger->error('Error Log');
2829
// LogLevel::warn()
29-
$this->logger->warning("Warn Log");
30+
$this->logger->warning('Warn Log');
3031
// LogLevel::info()
31-
$this->logger->info("Info Log");
32-
$this->logger->notice("Notice Log");
32+
$this->logger->info('Info Log');
33+
$this->logger->notice('Notice Log');
3334
// LogLevel::debug()
34-
$this->logger->debug("Debug Log");
35+
$this->logger->debug('Debug Log');
3536

3637
return new Response();
3738
}
3839

3940
public function loggingWithError()
4041
{
41-
$this->logger->emergency("Something is not right");
42-
$this->logger->error("About to crash");
43-
throw new \RuntimeException("Crash");
42+
$this->logger->emergency('Something is not right');
43+
$this->logger->error('About to crash');
44+
throw new \RuntimeException('Crash');
4445
}
45-
4646
}

tests/End2End/App/KernelWithLogging.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sentry\SentryBundle\Tests\End2End\App;
46

57
use Symfony\Component\Config\Loader\LoaderInterface;
68

79
class KernelWithLogging extends Kernel
810
{
9-
1011
public function registerContainerConfiguration(LoaderInterface $loader): void
1112
{
1213
parent::registerContainerConfiguration($loader);

tests/End2End/LoggingCommandTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sentry\SentryBundle\Tests\End2End;
46

57
use Sentry\Logs\Log;
@@ -12,7 +14,6 @@
1214

1315
class LoggingCommandTest extends WebTestCase
1416
{
15-
1617
/**
1718
* @var Application
1819
*/
@@ -31,7 +32,7 @@ protected function setUp(): void
3132

3233
public function testLogsInCommand(): void
3334
{
34-
$this->application->doRun(new ArgvInput(['bin/console', "log:test"]), new NullOutput());
35+
$this->application->doRun(new ArgvInput(['bin/console', 'log:test']), new NullOutput());
3536

3637
$this->assertCount(1, StubTransport::$events);
3738
$event = StubTransport::$events[0];
@@ -49,8 +50,8 @@ public function testLogsInCommand(): void
4950
public function testExceptionLogsInCommand(): void
5051
{
5152
try {
52-
$this->application->doRun(new ArgvInput(['bin/console', "log:nosub"]), new NullOutput());
53-
$this->fail("Expected exception never occurred");
53+
$this->application->doRun(new ArgvInput(['bin/console', 'log:nosub']), new NullOutput());
54+
$this->fail('Expected exception never occurred');
5455
} catch (\Throwable $t) {
5556
}
5657

@@ -70,10 +71,9 @@ public function testExceptionLogsInCommand(): void
7071
public function testExceptionLogsWithSubcommand(): void
7172
{
7273
try {
73-
$this->application->doRun(new ArgvInput(['bin/console', "log:sub"]), new NullOutput());
74-
$this->fail("Expected exception never occurred");
74+
$this->application->doRun(new ArgvInput(['bin/console', 'log:sub']), new NullOutput());
75+
$this->fail('Expected exception never occurred');
7576
} catch (\Throwable $t) {
76-
7777
}
7878

7979
// 1.) Logs from subcommand
@@ -105,7 +105,7 @@ private function findOneByLevel(array $logs, LogLevel $level): ?Log
105105
return $log;
106106
}
107107
}
108+
108109
return null;
109110
}
110-
111111
}

tests/End2End/LoggingEnd2EndTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sentry\SentryBundle\Tests\End2End;
46

57
use Sentry\Logs\Log;
@@ -56,13 +58,14 @@ public function testExceptionWithLogs(): void
5658
* Removes framework logs so that the tests can focus on our expected logs.
5759
*
5860
* @param Log[] $logs
61+
*
5962
* @return Log[]
6063
*/
6164
private function filterFrameworkLogs(array $logs): array
6265
{
6366
return array_filter($logs, function (Log $log) {
64-
return $log->getBody() !== 'Matched route "{route}".'
65-
&& $log->getBody() !== 'Notified event "{event}" to listener "{listener}".';
67+
return 'Matched route "{route}".' !== $log->getBody()
68+
&& 'Notified event "{event}" to listener "{listener}".' !== $log->getBody();
6669
});
6770
}
6871
}

0 commit comments

Comments
 (0)