You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
False positive: Array shapes in generics with nullable values on levels below 8 #9377
When a class has array shape in one of it's generic arguments, and the type is compared against the same exact thing PHPStan produces an error on levels below 8 with bleeding edge enabled. But error does not happen on level 8.
@@ @@+12: Function foo() returns void but does not have any side effects.
23: Parameter #1 $foo of function foo expects HelloWorld<array{id: int|null}>, HelloWorld<array{id: int|null}> given.
Full report
Line
Error
12
Function foo() returns void but does not have any side effects.
23
`Parameter #1 $foo of function foo expects HelloWorld<array{id: int
@@ @@+18: Function bar() should return HelloWorld<array{id: int|null}> but returns HelloWorld<array{id: int|null}>.
23: Parameter #1 $foo of function foo expects HelloWorld<array{id: int|null}>, HelloWorld<array{id: int|null}> given.
Full report
Line
Error
18
`Function bar() should return HelloWorld<array{id: int
23
`Parameter #1 $foo of function foo expects HelloWorld<array{id: int
Activity
ondrejmirtes commentedon May 30, 2023
Yeah, level 8 is correct here (there should be no errors) because it no longer touches and corrupts nullable types like
int|null.phpstan-bot commentedon Mar 29, 2024
@canvural After the latest push in 1.11.x, PHPStan now reports different result with your code snippet:
Full report
Function foo() returns void but does not have any side effects.VincentLanglet commentedon Aug 2, 2025
This is the same issue than #9096 (comment)
phpstan-bot commentedon Sep 7, 2026
@canvural After the latest push in 2.3.x, PHPStan now reports different result with your code snippet:
Full report
phpstan-bot commentedon Sep 10, 2026
Closed via merging phpstan/phpstan-src#6392
github-actions commentedon Oct 12, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.