Skip to content

PHPStan loses type information after null coalescing on array with 63 or more properties #9397

@RobertoGeuke

Description

@RobertoGeuke

Bug report

After null coalescing PHPStan loses type information on all other properties of the array. The new type of those properties becomes a union of all used types in the array (e.g. bool|int|string|null). This error only happens when the array contains 63 or more properties. See snippet for more information.

Code snippet that reproduces the problem

https://phpstan.org/r/9926eff3-05d8-4444-8510-1ed26a8368d1

Expected output

PHPStan should remember the type of all properties in the array, regardless of usage of null coalescing or amount of properties.

Did PHPStan help you today? Did it make you happy in any way?

PHPStan helps us a lot during our daily work 😀

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions