-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Array shape of ServiceManager config contains unspecific array #212
Comments
…iceManager fixes laminas#212 Signed-off-by: Thomas Rieschl <[email protected]>
Just my 2 cents here: There absolutely 0 difference for psalm (and most probably phpstan) between Would you mind raising a question in psalm itself to see what the general idea of this kind of notation is on their side? I am not against this change but I want to explain that we do not explicitly provide support for phpstan and therefore there might be changes happening in laminas which are only supported by psalm and not by phpstan. |
Thanks for the feedback! It's of course up to you if you want to change that or not. |
I think Also not opposed to the change, as I understand that PHPStan screams about "no array shape specified". |
PHPStan complains if there is no array value defined ( |
So that also would be the case for IMHO, that is some kind of phpstan specific personal flavor of how to write code. I am the last dude who says "lets not be specific" but unless the annotation gives more value, I tend to avoid it. IMHO Again, I'd love to see an issue created in psalm where we try to figure out if there are plans for psalm to change this behavior at some point. If not, I'd rather have phpstan and psalm align on that decision. |
hrhr, that's a point 😄 although I'd say that an array is usually more complex than an int and most of the time there's no specific range to pass (and if there is, we do specify a range) whereas normally a method does require or return some specific array shape and thus writing |
I do not have a problem with |
…iceManager fixes laminas#212 Signed-off-by: Thomas Rieschl <[email protected]>
I've opened an issue in psalm: vimeo/psalm#10287 |
Closed with #213 |
No, the PHPStan rule only applies to iterable types: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type (unfortunately there's a bug that prevents this from getting applied to Generator but that's acdifferent story) |
Bug Report
Summary
Not really a bug but more of a QA issue.
The
ServiceManager
sServiceManagerConfiguration
array shape contains aservices
key with an unspecificarray
notation. That trips some static analyzers.Current behavior
ServiceManagerConfiguration
contains the definition:services?: array<string,object|array>,
which includes a genericarray
.How to reproduce
Use the
ServiceManagerConfiguration
configuration anywhere and run PHPStan (I tried 1.10) which emitsPHPDoc tag @var for variable $serviceManagerConfig has no value type specified in iterable type array.
Expected behavior
PHPStan should not throw an error. This is achieved by using a more "specific" array definition:
array<array-key, mixed>
.The text was updated successfully, but these errors were encountered: