-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Rule to force syntax of array notation in PHPDocs #4698
Comments
FYI: such fixer exists, but there is one scenario when it breaks the valid annotation. |
For what it's worth: Since 8.1 we have the concept of That makes
So to me, that only makes the following flavors possible: /**
* @param array<string, Foo> Key is important, and it's a string
* @param array<int, Foo> Key is important, and it's an integer
* @param list<Foo> It's a list, only values are important, everything is indexed from 0
*/ I hope to find a rule that automatically converts |
@ruudk thank you for the input! Personally I am not sure if it matters that much, |
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
myself, I would love to forbid usage of array is very overpacked and one cannot be sure what they will deal with, when receiving it.. above is different than normalization of |
@keradus I believe that your preference is out of the scope of this particular issue / feature request. Even though it may be valid, it's something more strict that not everyone in userland is interested in. This issue is about standardising the format of array types in phpDoc, not about making it more strict, which is IMHO a separate thing, more for tools like PHPStan than Fixer. |
you can treat my comment as:
yes, we can keep original idea of unification open, no harm in it. just no commitment into implementing it by community since 2019 🤷🏻 |
Actually it was implemented 2 years ago, but not in the core 😉. Why it was done like this is a separate story. |
if it matters in context of main repo, we can either have own implementation (not sure if makes sense), incorporate custom rule to main repo (suggested for rules in general few times, some owners raised some of rules to be incorporated to main repo ;) ), or say it's not worth to implement due to userland solution. I doubt it makes sense to keep this idea open, if we are not progressing on it for so many years. let's be realistic :) |
I agree, I kept this issue open only because I was hoping that @kubawerlos is open to migrate this fixer to the core (himself, or by letting others to do it), that's why it has "easy pick" label. If it's not the case, then I believe we should close this. |
In PHPDocs, there are two possible syntaxes for array values:
For consistence I think it would be nice to have a rule that forces a single syntax.
The text was updated successfully, but these errors were encountered: