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
Convert array<V>
phpdoc to array<array-key, V>
#7837
Comments
I believe the risky flag can't be removed, as this was explicitly requested by @keradus to treat it as such. But definitely |
@Wirone can you please prove with https://phpstan.org/try demo that the usecase you defend, ie. #7812 (comment), more precisely the |
PhpdocListTypeFixer
- array<V>
to array<array-key, V>
array<V>
phpdoc to array<array-key, V>
I didn't defend anything there, I even questioned the need of marking that fixer as risky. Just pointed that if we consider it as risky, then description should be better than it was at that point, pointing to the only difference known to me. Especially this part:
As a quick check, there's a difference between this ( |
Thank you - you found the difference!
@kubawerlos the #7812 risky description should be improved: -Risky when using ``T[]`` in union types.
+Risky when using ``T[]`` in union type with iterable type without generics explicitly defined like `Collection|T[]`. and preferably with the link to this post or to the 3 cases/explanations above. |
Feature request
I understand that very commonly
array<V>
, ie. array phpdoc /wo key type, very commonly representslist<V>
, hovewer definitely not always.This is a feature request to fix
array<V>
toarray<array-key, V>
phpdoc instead which is trully equivalent and non-risky, so it can be applied safely even for large codebases and improved gradually (ie. tolist<V>
, key type improved or left if any key is allowed).related with #7796 - but a new fixer should be probably introduced to be named better (like
PhpdocArrayWithoutKeyTypeFixer
) and be non-risky, maybe #7812 can be made non-risky, as IMO it is non-risky, see unresolved #7812 (comment)/cc @Wirone @kubawerlos @keradus
The text was updated successfully, but these errors were encountered: