Skip to content

Commit 921ebbc

Browse files
authored
Merge pull request #87 from samsonasik/update-phpstan
[PHPStan] Update to PHPStan ^1.6
2 parents cc94443 + 4b87bee commit 921ebbc

File tree

7 files changed

+12
-9
lines changed

7 files changed

+12
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"mezzio/mezzio-laminasviewrenderer": "^2.3",
7272
"northwoods/container": "^3.0",
7373
"php-coveralls/php-coveralls": "^2.4",
74-
"phpstan/phpstan": "1.5.6 as 1.6",
74+
"phpstan/phpstan": "^1.6.7",
7575
"phpstan/phpstan-webmozart-assert": "^1.0",
7676
"pimple/pimple": "^3.2",
7777
"rector/rector": "dev-main",

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
includes:
22
- vendor/phpstan/phpstan-webmozart-assert/extension.neon
3-
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
43

54
parameters:
65
excludePaths:
@@ -9,6 +8,7 @@ parameters:
98
- src/Middleware/Routed/Preview/ErrorPreviewAction.php
109
checkMissingIterableValueType: false
1110
reportUnmatchedIgnoredErrors: false
11+
treatPhpDocTypesAsCertain: false
1212
ignoreErrors:
1313
- '#function set_error_handler expects (callable(int, string, string, int, array): bool)*#'
1414
- '#Invalid type object to throw#'

src/Handler/Formatter/Json.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Json extends BaseJson implements FormatterInterface
2222
private const TIMESTAMP = 'timestamp';
2323

2424
/**
25-
* @param array $event event data
25+
* @param array<string, DateTime> $event event data
2626
* @return string formatted line to write to the log
2727
*/
2828
public function format($event): string

src/HeroConstant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
class HeroConstant
2424
{
25-
/** @var array */
25+
/** @var array<int, string> */
2626
public const ERROR_TYPE = [
2727
E_ERROR => 'E_ERROR',
2828
E_WARNING => 'E_WARNING',

src/HeroFunction.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ function detectMessageContentType(string $message): string
1818
: (strip_tags($message) === $message ? 'text/plain' : 'text/html');
1919
}
2020

21+
/**
22+
* @param array<int, string|array<int, string>> $excludeExceptionsConfig
23+
*/
2124
function isExcludedException(array $excludeExceptionsConfig, Throwable $throwable): bool
2225
{
2326
$exceptionOrErrorClass = $throwable::class;

src/HeroTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public function phpError(...$args): void
5555
set_error_handler([$this, 'phpErrorHandler']);
5656
}
5757

58-
private static function isUncaught(array $error): bool
58+
private static function isUncaught(string $message): bool
5959
{
60-
return str_starts_with($error['message'], 'Uncaught');
60+
return str_starts_with($message, 'Uncaught');
6161
}
6262

6363
public function phpFatalErrorHandler(string $buffer): string
@@ -67,7 +67,7 @@ public function phpFatalErrorHandler(string $buffer): string
6767
return $buffer;
6868
}
6969

70-
return self::isUncaught($error) || $this->result === ''
70+
return self::isUncaught($error['message']) || $this->result === ''
7171
? $buffer
7272
: $this->result;
7373
}
@@ -79,7 +79,7 @@ public function execOnShutdown(): void
7979
return;
8080
}
8181

82-
if (self::isUncaught($error)) {
82+
if (self::isUncaught($error['message'])) {
8383
return;
8484
}
8585

src/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function doctrineTransform(ModuleEvent $moduleEvent): void
3232
return;
3333
}
3434

35-
/** @var array $configuration */
35+
/** @var array<string, mixed> $configuration */
3636
$configuration = $container->get('config');
3737
$configuration['db'] ?? Doctrine::transform($container, $configuration);
3838
}

0 commit comments

Comments
 (0)