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
fix: Correctly indent multiline constants and properties #7875
fix: Correctly indent multiline constants and properties #7875
Conversation
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.
Some optional cosmetic changes, if you agree with them. Can be also merged as-is, you decide 🙂.
* Returns whether the token at given index is the last token in a property | ||
* declaration before the type or the name of that property. | ||
*/ | ||
private function isPropertyStart(Tokens $tokens, int $index): bool |
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.
This would be more helpful as a commonly-accessible helper method. I believe we have similar thing somewhere else already, and it's getting out of hand 😅. But it's good enough, I don't expect you finding better place for it at this point. I just think, in general, we need more reusable code for token traversing, manipulating etc.
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.
I agree but in this case the method is quite specific: we want the last token before the type or the property name. This is due to how the fixer is currently implemented and it wouldn't be surprising to see that changed in the future, so I'd keep it here for now.
b2ea810
to
d340ae5
Compare
d340ae5
to
9d1376a
Compare
Fixes #7866 and #6509.