-
Notifications
You must be signed in to change notification settings - Fork 56
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
Use SemicolonSpacing Sniff #53
Conversation
tests/input/not_spacing.php
Outdated
@@ -5,11 +5,11 @@ | |||
$test = 1; | |||
|
|||
if (!$test > 0) { | |||
echo 1; | |||
echo 1 ; |
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 file is not appropriate place for such tests, it is supposed to test NOT 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.
@Majkl578 can you elaborate? I don't understand this comment
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.
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.
Ah yes, that needs changing.
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'll also rename the file than, so new contributors can identify that better as well.
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.
As pointed out by @Majkl578 let's have new files to test new sniffs, that isolates things better and avoids unexpected results.
530b2fa
6bd28d7
to
530b2fa
Compare
echo -1 ; | ||
|
||
echo 'foo' | ||
; |
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.
Maybe add an example with something multiline, like a chain of method calls, or maybe a heredoc, because that's the only case where I would consider adding a newline before a semicolon.
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.
Maybe something like if that is even supported? :P
$qb->select()
->from()
->where()
;
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.
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.
It should be reported and fixed IMO. Just my opinion though.
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.
@greg0ire you mean "->where();" fixing or trimming-whitespaces-fixing? Personally I'm leaving ;
in new line for builders and such so adding line doesn't require looking for semicolon and also diff is +1/0 instead of +2/-1 (similar to comma in 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.
All in favor of switching to the former, please upvote this. All against, please downvote.
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.
@greg0ire You have my upvote, we just need to figure out how to deal with the Sniff. Also, can you please look at the fails? I can’t figure out what is wrong 👎
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.
There must be an extra or missing newline somewhere… 8a9
sounds like it would be around like 8
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.
Can we please leave it out of this specific patch and use the normal approval (and a dedicated PR) for this?
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.
Can you really leave the part with the qb out if you have the part with
echo 'foo'
;
?
How is it different exactly? If we go with @malarzm proposal then we have an issue don't we?
530b2fa
to
9435332
Compare
tests/fixed/semicolon_spacing.php
Outdated
|
||
$qb->select() | ||
->from() | ||
->where(); |
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.
EOL is missing
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.
Isn't that what CS is complaining, but I also couldn't identified what is :(
3c8e43e
to
fb81f14
Compare
fb81f14
to
7142611
Compare
PR ready for voting 🎉 |
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'd like to revisit the multiline stuff tho
Suggested by @guilhermeblanco based on
zendframework/zend-coding-standard#1
.