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
Spreading an associative array into a generic function/method call may restrict optional arguments to their default values. #12363
When spreading an associative array into a function or method call the type of a generic optional argument may be unexpectedly restricted to its default value.
Did PHPStan help you today? Did it make you happy in any way?
Yes, for sure!
We at @sport-iat heavily rely on PHPStan to statically validate our code against self-generated array shape typedefs (from JSON schema definitions) together with @opis/json-schema for validation at runtime. So a big thanks to everyone involved in this great project!
Currently, I'm trying to figure out if/how generated DTO-like classes could replace our array shapes with the help of advanced hydration/normalization techniques as provided by i.e. @CuyZ/Valinor. Thats actually why I discovered the unexpected behavior for generic class constructors having optional arguments: https://phpstan.org/r/1e4a2a1d-2beb-46d8-809c-6fdc631efd33.
Activity
Fix template type resolution for spread of associative arrays
Fix template type resolution for spread of associative arrays
phpstan-bot commentedon Mar 8, 2026
Closed via merging phpstan/phpstan-src#5079
Updated PHPStan to commit 2913caa9e7db212965e45c0f14be87f6211c8d8c
Updated PHPStan to commit 869ddb34b4766450d424fedf513cf61ca85eba27
github-actions commentedon Apr 9, 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.