docs: Add allowed values of tags in the phpdoc_align#7120
docs: Add allowed values of tags in the phpdoc_align#7120Wirone merged 1 commit intoPHP-CS-Fixer:masterfrom
phpdoc_align#7120Conversation
phpdoc_align docphpdoc_align doc
43f858f to
2314e20
Compare
2314e20 to
160ae3f
Compare
160ae3f to
c552659
Compare
Wirone
left a comment
There was a problem hiding this comment.
Thank you @kayw-geek for your contribution but unfortunately it looks like it can't be merged in this form. Allowed values for tags in phpdoc_align are not specified by design, because you can pass any tags there:
Tags that you have grouped into allowed values set are defined inside fixer to determine the type of tag (@tag <hint> <$var> vs @tag <hint> vs @tag <hint> <signature>, all with optional <desc>) and only represent known tags for each format. It is not complete set of allowed values. Even though it could be helpful for some people, others could be confused.
What we could do is to include supported tags (set currently used for allowed values) and include it somehow in the tags description, like it was done in #6360 for ordered_class_elements fixer. We could even display those tags grouped into sections ("tags with name", "tags with method signature") and describe how it works. If you want to help with this, then let's continue here, but if you don't want do such changes, then let's close this PR 🙂.
|
@Wirone Since the functionality can support fixing all tags, why should we limit users? |
|
It's a technical limitation of how phpDoc is parsed with regex. There are some annotations that have type, variable name (and optional description), there are other with only 1 value or with different parts. Fixer allows providing any tags to align, but only some of them are categorised and handled "properly". We could add ability to provide types for custom tags (so you would be able to say that |
0523ca0 to
b7aada7
Compare
|
@Wirone Sorry, some work has delayed the update of this PR. This 'CI / PHP 8.2 on macOS (pull_request) ' job should need to try run |
70e71c8 to
3d2cf52
Compare
c788d17 to
d724e6e
Compare
d724e6e to
d94866c
Compare
|
@kayw-geek you can run auto-review tests locally with |
d94866c to
9c7083c
Compare
|
@Wirone Do we need to use |
9c7083c to
8ca41f0
Compare
|
@kayw-geek I've checked-out your branch and run Can you do it, so we're 100% sure everything is fine? |
8ca41f0 to
655d528
Compare
phpdoc_align docphpdoc_align docs
phpdoc_align docsphpdoc_align
|
@kayw-geek these are not related. I just had yet another doubt about formatting and thought I could do it myself instead of bothering you again and again, but unfortunately I had no time for it. It's about square brackets inside parentheses, it doesn't make much sense, but I overlooked it somehow 🫠. |
655d528 to
a5e550f
Compare
|
@Wirone So friendly. This is the duty of the PR author. |
Wirone
left a comment
There was a problem hiding this comment.
@Wirone I noticed that the code block was not displayed correctly in the description of options in list doc. Is this the expected behavior?
Do we need to use
RstUtils::toRstto convert in other PR?kayw-geek/PHP-CS-Fixer@
9c7083c/src/Documentation/ListDocumentGenerator.php#L96
Now I got what you were talking about, probably. Even though doc/rules/phpdoc/phpdoc_align.rst is OK, doc/list.rst has single backticks so allowed values are displayed differently:

However, this is not responsibility of this PR to fix this, so if you're interested in it you could prepare another PR that would fix how these options are rendered in the rules' list 🙂. This PR looks OK 👍.
|
Thank you @kayw-geek 🍻 |

The current document lacks configurable values, which makes it inconvenient for users to configure.