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

Union between array shape and 'normal' array gives some strange results #7759

Open
BackEndTea opened this issue Aug 8, 2022 · 4 comments
Open

Comments

@BackEndTea
Copy link
Contributor

Bug report

It appears the union between a shaped array and a 'normal' one tries to generalize some things where it shouldn't.

Code snippet that reproduces the problem

https://phpstan.org/r/4e6611d0-89ac-486d-8636-fb9a57c8cb4e

Expected output

No errors

@ondrejmirtes
Copy link
Member

I'm happy with these results. What types would you expect?

@BackEndTea
Copy link
Contributor Author

My problem is that any string key may now contain an array, instead of just the one key. Causing errors dor the function call

@ondrejmirtes
Copy link
Member

I guess you're asking for a feature that doesn't exist yet. You want something like this for array shapes: https://www.typescriptlang.org/docs/handbook/2/objects.html#index-signatures

@mvorisek
Copy link
Contributor

mvorisek commented Jul 26, 2023

another repro: https://phpstan.org/r/ee626b1b-2f3f-4e46-8c8c-6dea65949a5d - it seems the intersect is completely ignored

related with #8438 as array shape is currently not sealed nor unsealed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants