-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Generic.CodeAnalysis.EmptyStatement Add option to allow only comments in statements #2240
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,4 +69,18 @@ try { | |
// TODO: Handle this exception later :-) | ||
} | ||
|
||
if (true) {} elseif (false) {} | ||
if (true) {} elseif (false) {} | ||
|
||
// phpcs:set Generic.CodeAnalysis.EmptyStatement allowComments true | ||
|
||
if ($foo) { | ||
// Just a comment | ||
} elseif ($bar) { | ||
/* | ||
* Yet another comment | ||
*/ | ||
} elseif ($baz) { | ||
// phpcs:set Generic.CodeAnalysis.EmptyStatement somethingMadeUp true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To prevent confusion between real test related PHPCS annotations and annotations which are part of the test, it's better to use something like |
||
} else { | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should probably reset the changed property to the default at the end of this test to prevent issues with future test cases being added. |
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.
Wasn't expecting to have to change this, but skips the last token otherwise.
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 is a known issue, see #1319