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

Specify explicit mixed array type via is_array #1191

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Apr 8, 2022

Relates to phpstan/phpstan#7004

Fixes strict array shape / mixed handling with level 9, e.g. https://phpstan.org/r/77a8e65b-dd07-4c4b-bc8c-76a32243d553

The discussion-7004.php is not adhering to standards.. let me know if this should be renamed, or if I should create an issue or so.

UPDATE: moved behind a feature toggle that is only enabled in bleedingEdge, as discussed, to avoid wreaking havoc on level 9 :)

@herndlm herndlm changed the base branch from 1.6.x to 1.5.x April 8, 2022 20:13
@herndlm herndlm force-pushed the specify-explicit-mixed-array-type-via-is-array branch from 8ea5ad2 to c880b7f Compare April 8, 2022 20:15
@ondrejmirtes
Copy link
Member

My fear is that this will wreak havoc on level 9 codebases (https://github.com/phpstan/phpstan-src/runs/5891253618?check_suite_focus=true). I'd rather if the explicit mixed was passed only when bleedingEdge is enabled.

@herndlm
Copy link
Contributor Author

herndlm commented Apr 8, 2022

Isn't that what level 9 is for? 😅
I'll take a look tomorrow

@ondrejmirtes
Copy link
Member

Yeah but this situation can be seen as a new check: https://phpstan.org/user-guide/backward-compatibility-promise

The library of performed rules on analysed code, and the meaning of rule levels does not change in minor/patch versions.

@herndlm
Copy link
Contributor Author

herndlm commented Apr 8, 2022

Definitely

@herndlm
Copy link
Contributor Author

herndlm commented Apr 12, 2022

I think this should be fine, let me know if there is more needed :)

@herndlm herndlm force-pushed the specify-explicit-mixed-array-type-via-is-array branch from 3d73930 to 56207bd Compare April 12, 2022 12:37
@ondrejmirtes ondrejmirtes merged commit 025fde0 into phpstan:1.5.x Apr 12, 2022
@ondrejmirtes
Copy link
Member

Thank you!

@herndlm herndlm deleted the specify-explicit-mixed-array-type-via-is-array branch April 12, 2022 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants