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. |
Since this issue has not had any activity within the last 90 days, I have marked it as stale. The purpose of this action is to enforce backlog review once in a while. This is mostly for maintainers and helps with keeping repository in good condition, because stale issues and PRs can accumulate over time and make it harder for others to find relevant information. It is also possible that some changes has been made to the repo already, and issue or PR became outdated, but wasn't closed for some reason. This action helps with periodic review and closing of such stale items in automated way. You may let maintainers handle this or verify current relevancy by yourself, to help with re-triage. Any activity will remove stale label so it won't be automatically closed at this point. I will close it if no further activity occurs within the next 30 days. |
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: