Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix internal error when DIC param map has > 256 items #402

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

janedbal
Copy link
Contributor

@janedbal janedbal commented Jul 18, 2024

The failure happened here.


Generally, this feels like a trap inside PHPStan. If any ConstantArrayType will fail when used in implode or just with any usage of TypeUtils::flattenTypes, it is just not safe to create it by constructor and the degradation logic in ConstantArrayTypeBuilder should be imo moved to ConstantArrayType constructor.

Or maybe just getAllArrays needs to be fixed? IDK where is the proper place to fix this.

@ondrejmirtes
Copy link
Member

I feel like we should make a rule in PHPStan so that ConstantArrayTypeBuilder is used instead of new ConstantArrayType when the size of the created array is unknown. Because:

should be imo moved to ConstantArrayType constructor.

That's too late, you can't return a different type from a class constructor.

Otherwise I think this is the right fix. Thank you.

@ondrejmirtes ondrejmirtes merged commit ee88a01 into phpstan:1.4.x Aug 9, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants