-
-
Notifications
You must be signed in to change notification settings - Fork 488
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 sniffs documentation (Related to #1722) #1737
Conversation
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Correct whitespace for index keys"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start with Valid:
.
$post_title = $post['post_title']; | ||
]]> | ||
</code> | ||
<code title="Incorrect spacing"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start with Invalid:
.
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Double arrow operators aligned"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start with Valid:
.
); | ||
]]> | ||
</code> | ||
<code title="Not aligned; harder to read"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start with Invalid:
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Can you please rebase locally to squash the commits into a single commit (or better: one per XML file), and then force-push please?
1f0033b
to
af0ce75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mike-Hermans Hi Mike, please accept my apologies for the delay in me reviewing this PR and thank you for the adjustments you've made so far.
The docs are mostly looking very good, just a few more remarks.
ArrayKeySpacingRestrictions
- The docs are missing the
<em> ...</em>
tags to highlight good/bad code, but we weren't that clear about that in the initial explanation, so sorry about that!. - Would it have value to add an example of an array key consisting of a PHP constant ? and/or an array key which is concatenated together ? In both cases, spaces on the inside of the brackets are expected.
MultipleStatementAlignment
- I'm missing a code sample where there are no spaces/inconsistent spaces around the arrows. The current code sample only addresses aligning the arrows.
Think: too much space after the arrow, no space before/after the arrow. - Also: What about adding another example with a single line array ?
@Mike-Hermans Just wondering if you'll have a chance to finish this off in the near future. If you haven't got time or lost interest, please let us know and we'll see if we can find someone to take over. |
I've updated the examples in ArrayKeySpacingRestrictions to include both a concatenated string and a constant. For MultipleStatementAlignment I've added another block with code comparision to show the correct spacing in single line arrays, and the multiple spaces for alignment in multi-line arrays. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Mike-Hermans, thank you for the update. Nearly there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mike-Hermans Thanks for that last update. Merging now.
Adds documentation for the following sniffs:
Related to #1722