Skip to content

Commit

Permalink
Fix normalizeException types, fixes #1924
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Nov 17, 2024
1 parent 32e515f commit e940004
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
26 changes: 4 additions & 22 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,6 @@ parameters:
count: 1
path: src/Monolog/ErrorHandler.php

-
message: '#^Method Monolog\\Formatter\\JsonFormatter\:\:normalizeException\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/Monolog/Formatter/JsonFormatter.php

-
message: '#^PHPDoc tag @return with type array\<string, array\<array\<string\>\|int\|string\>\|int\|string\>\|string is not subtype of native type array\.$#'
identifier: return.phpDocType
count: 1
path: src/Monolog/Formatter/JsonFormatter.php

-
message: '#^Return type \(array\) of method Monolog\\Formatter\\JsonFormatter\:\:normalizeException\(\) should be covariant with return type \(array\<string, array\<array\<string\>\|int\|string\>\|int\|string\>\|string\) of method Monolog\\Formatter\\NormalizerFormatter\:\:normalizeException\(\)$#'
identifier: method.childReturnType
count: 1
path: src/Monolog/Formatter/JsonFormatter.php

-
message: '#^Return type \(array\<array\<mixed\>\|bool\|float\|int\|object\|string\|null\>\|bool\|float\|int\|object\|string\|null\) of method Monolog\\Formatter\\JsonFormatter\:\:normalize\(\) should be covariant with return type \(array\<array\<mixed\>\|bool\|float\|int\|string\|null\>\|bool\|float\|int\|string\|null\) of method Monolog\\Formatter\\NormalizerFormatter\:\:normalize\(\)$#'
identifier: method.childReturnType
Expand All @@ -37,13 +19,13 @@ parameters:
path: src/Monolog/Formatter/JsonFormatter.php

-
message: '#^Method Monolog\\Formatter\\NormalizerFormatter\:\:normalizeException\(\) should return array\<string, array\<array\<string\>\|int\|string\>\|int\|string\>\|string but returns array\<int, string\>\.$#'
identifier: return.type
message: '#^Return type \(string\) of method Monolog\\Formatter\\LineFormatter\:\:normalizeException\(\) should be compatible with return type \(array\<array\<array\<string\>\|int\|string\>\|int\|string\>\) of method Monolog\\Formatter\\NormalizerFormatter\:\:normalizeException\(\)$#'
identifier: method.childReturnType
count: 1
path: src/Monolog/Formatter/NormalizerFormatter.php
path: src/Monolog/Formatter/LineFormatter.php

-
message: '#^Method Monolog\\Formatter\\NormalizerFormatter\:\:normalizeException\(\) should return array\<string, array\<array\<string\>\|int\|string\>\|int\|string\>\|string but returns array\<string, array\<int\<0, max\>\|string, array\<array\<string\>\|int\|string\>\|int\|string\>\|int\|string\>\.$#'
message: '#^Method Monolog\\Formatter\\NormalizerFormatter\:\:normalizeException\(\) should return array\<array\<array\<string\>\|int\|string\>\|int\|string\> but returns array\<string, array\<array\<array\<string\>\|int\|string\>\|int\|string\>\|int\|string\>\.$#'
identifier: return.type
count: 1
path: src/Monolog/Formatter/NormalizerFormatter.php
Expand Down
2 changes: 1 addition & 1 deletion src/Monolog/Formatter/JsonFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ protected function normalize(mixed $data, int $depth = 0): mixed
* Normalizes given exception with or without its own stack trace based on
* `includeStacktraces` property.
*
* @return array<string, string|int|array<string|int|array<string>>>|string
* @return array<array-key, string|int|array<string|int|array<string>>>
*/
protected function normalizeException(Throwable $e, int $depth = 0): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Monolog/Formatter/NormalizerFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ protected function normalize(mixed $data, int $depth = 0): mixed
}

/**
* @return array<string, string|int|array<string|int|array<string>>>|string
* @return array<array-key, string|int|array<string|int|array<string>>>
*/
protected function normalizeException(Throwable $e, int $depth = 0)
{
Expand Down

0 comments on commit e940004

Please sign in to comment.