Use explicit mixed for global array variables#1411
Use explicit mixed for global array variables#1411ondrejmirtes merged 3 commits intophpstan:1.7.xfrom
Conversation
07db8b4 to
42f333b
Compare
|
Definitely needs to be a bleedingEdge tag :) Don't forget to update LazyScopeFactory + DirectScopeFactory. |
…dForGlobalVariables`
59b16c4 to
584c30d
Compare
|
Perfect, thank you! |
|
Hey there. Just a question @herndlm :
How exactly do you do that in this scenario ? Storing the value of the global array you want to use into a variable and using |
|
Developers should never use The right approach now is cuyz/valinor, or azjezz/psl. |
yeah, basically just https://phpstan.org/writing-php-code/narrowing-types. We just had some simple primitive type fields/vars from $_POST, just as the playground-snippet from the linked discussion. for more complex array shapes I would definitely also try to use what Ondrej suggested in the previous comment. Never used those libs, but they are on my list :) |
Refs: phpstan/phpstan#7450
well, let's see how much this will break..