Skip to content

Commit 479dff6

Browse files
committed
CS Fix
1 parent 242ff78 commit 479dff6

File tree

4 files changed

+27
-52
lines changed

4 files changed

+27
-52
lines changed

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
"php": "~8.1.0 || ~8.2.0"
1515
},
1616
"require-dev": {
17-
"phpstan/phpstan": "^1.9.17",
18-
"phpstan/phpstan-phpunit": "^1.3.4",
19-
"phpstan/phpstan-strict-rules": "^1.4.5",
20-
"phpunit/phpunit": "^10.0.7",
21-
"slam/php-cs-fixer-extensions": "^3.3",
22-
"slam/php-debug-r": "^1.7.0",
23-
"symfony/console": "^6.2.5"
17+
"phpstan/phpstan": "^1.10.33",
18+
"phpstan/phpstan-phpunit": "^1.3.14",
19+
"phpstan/phpstan-strict-rules": "^1.5.1",
20+
"phpunit/phpunit": "^10.3.3",
21+
"slam/php-cs-fixer-extensions": "^3.8",
22+
"slam/php-debug-r": "^1.8.0",
23+
"symfony/console": "^6.3.4"
2424
},
2525
"autoload": {
2626
"psr-4": {

lib/ErrorHandler.php

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,23 @@ final class ErrorHandler
3737
private ?bool $cli = null;
3838
private ?int $terminalWidth = null;
3939

40-
/**
41-
* @var null|resource
42-
*/
40+
/** @var null|resource */
4341
private $errorOutputStream;
4442
private bool $hasColorSupport = false;
4543
private ?bool $logErrors = null;
4644
private bool $logVariables = true;
4745
private ?bool $displayErrors = null;
4846

49-
/**
50-
* @var callable
51-
*/
47+
/** @var callable */
5248
private $emailCallback;
5349

54-
/**
55-
* @var callable
56-
*/
50+
/** @var callable */
5751
private $errorLogCallback = '\\error_log';
5852

59-
/**
60-
* @var array<int, bool>
61-
*/
53+
/** @var array<int, bool> */
6254
private array $scream = [];
6355

64-
/**
65-
* @var array<int, class-string<Throwable>>
66-
*/
56+
/** @var array<int, class-string<Throwable>> */
6757
private array $exceptionsTypesFor404 = [];
6858

6959
private bool $shouldEmail404Exceptions = true;
@@ -131,9 +121,7 @@ public function getTerminalWidth(): int
131121
return $this->terminalWidth;
132122
}
133123

134-
/**
135-
* @param mixed $errorOutputStream
136-
*/
124+
/** @param mixed $errorOutputStream */
137125
public function setErrorOutputStream($errorOutputStream): void
138126
{
139127
if (! \is_resource($errorOutputStream)) {
@@ -144,9 +132,7 @@ public function setErrorOutputStream($errorOutputStream): void
144132
$this->hasColorSupport = (\function_exists('posix_isatty') && @\posix_isatty($errorOutputStream));
145133
}
146134

147-
/**
148-
* @return resource
149-
*/
135+
/** @return resource */
150136
public function getErrorOutputStream()
151137
{
152138
if (null === $this->errorOutputStream) {
@@ -197,17 +183,13 @@ public function displayErrors(): bool
197183
return $this->displayErrors;
198184
}
199185

200-
/**
201-
* @param array<int, bool> $scream
202-
*/
186+
/** @param array<int, bool> $scream */
203187
public function setScreamSilencedErrors(array $scream): void
204188
{
205189
$this->scream = $scream;
206190
}
207191

208-
/**
209-
* @return array<int, bool>
210-
*/
192+
/** @return array<int, bool> */
211193
public function getScreamSilencedErrors(): array
212194
{
213195
return $this->scream;
@@ -465,17 +447,13 @@ private function purgeTrace(string $trace): string
465447
return \defined('ROOT_PATH') ? \str_replace(ROOT_PATH, '.', $trace) : $trace;
466448
}
467449

468-
/**
469-
* @param array<int, class-string<Throwable>> $exceptionsTypesFor404
470-
*/
450+
/** @param array<int, class-string<Throwable>> $exceptionsTypesFor404 */
471451
public function set404ExceptionTypes(array $exceptionsTypesFor404): void
472452
{
473453
$this->exceptionsTypesFor404 = $exceptionsTypesFor404;
474454
}
475455

476-
/**
477-
* @return array<int, class-string<Throwable>>
478-
*/
456+
/** @return array<int, class-string<Throwable>> */
479457
public function get404ExceptionTypes(): array
480458
{
481459
return $this->exceptionsTypesFor404;

phpunit.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
cacheDirectory=".phpunit.cache"
77
>
88
<coverage>
9-
<include>
10-
<directory suffix=".php">./lib</directory>
11-
</include>
129
<report>
1310
<clover outputFile="coverage/clover.xml"/>
1411
<html outputDirectory="coverage/html"/>
@@ -18,4 +15,9 @@
1815
<testsuite name="ErrorHandler">
1916
<directory>./tests</directory>
2017
</testsuite>
18+
<source>
19+
<include>
20+
<directory suffix=".php">./lib</directory>
21+
</include>
22+
</source>
2123
</phpunit>

tests/ErrorHandlerTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ final class ErrorHandlerTest extends TestCase
1818
private string $errorLog;
1919
private ErrorException $exception;
2020

21-
/**
22-
* @var array<int, array<string, string>>
23-
*/
21+
/** @var array<int, array<string, string>> */
2422
private array $emailsSent = [];
2523
private ErrorHandler $errorHandler;
2624

@@ -52,8 +50,7 @@ protected function tearDown(): void
5250

5351
public function testDefaultConfiguration(): void
5452
{
55-
$errorHandler = new ErrorHandler(function (): void {
56-
});
53+
$errorHandler = new ErrorHandler(function (): void {});
5754

5855
self::assertTrue($errorHandler->isCli());
5956
self::assertTrue($errorHandler->autoExit());
@@ -262,15 +259,13 @@ public function testTerminalWidthByEnv(): void
262259
$width = \mt_rand(1000, 9000);
263260
\putenv(\sprintf('COLUMNS=%s', $width));
264261

265-
$errorHandler = new ErrorHandler(function (): void {
266-
});
262+
$errorHandler = new ErrorHandler(function (): void {});
267263

268264
self::assertSame($width, $errorHandler->getTerminalWidth());
269265

270266
\putenv('COLUMNS');
271267

272-
$errorHandler = new ErrorHandler(function (): void {
273-
});
268+
$errorHandler = new ErrorHandler(function (): void {});
274269

275270
$terminal = new Terminal();
276271
self::assertSame($terminal->getWidth(), $errorHandler->getTerminalWidth());

0 commit comments

Comments
 (0)