-
-
Notifications
You must be signed in to change notification settings - Fork 479
-
-
Notifications
You must be signed in to change notification settings - Fork 479
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
Empty line is not required before block comment #538
Comments
Humm. Can you share your full source file? But it sounds like this is an issue being reported by |
The problem doesn't come every time I write a comment block, right know on my other projects doesn't appear. May be a latency of the editor to parse the code? |
I've ran into this one a number of times before as well. What about if we change that one from an |
Anyone still here ? Please respond to my question above. |
I would have started the comment block with Only a minor difference but even as is, I would not consider block comments in general to be too significant and setting this to a warning over an error would seem sensible. PS: I've been following the repo for a while; and, decided enough being a lurker (grin); but, I still feel I need to learn a lot more before I can really start contributing further. |
Then it would become a DocBlock, not a multi-line comment block. They are different things. https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#5-2-multi-line-comments clearly shows the clear line on the first line of the comment block, so while there might be a bug in a sniff that is un-necessarily highlighting this as an issue, I think it should stay as an |
I was not aware of that difference, I use a DocBlock "format" for all multiline comments in my code and they are not triggering any sniffs that I am aware of, should they? |
There's probably no direct harm in using What would cause more harm in terms of PHPCS, is doing the reverse; using |
I missed that ... and it took three different documents before I found the reference. Thanks for the heads-up! If anyone else needs the reference specifically, here it is: https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#5-2-multi-line-comments |
I linked to it in my first reply to you ;-) |
D'oh ... well, then I missed it twice :D |
OK, so I've had another look at this. The problem with the original code sample:
... is not actually shown in the code sample as it misses the wider context. Basically, when using a block comment, the sniff expects a blank above it, unless it is the first thing in the scope. So: $a = 'foo';
/*
* Block comment.
*/ ... will trigger a if ( $foo ) {
/*
* Block comment.
*/
} ... will trigger a The problem with the second code sample is something completely different: /* Set the post slug
*
* Other comments lines
*/ For multi-line block comments, the sniff expects the block comment opener Those message texts could possibly do with some clarification (upstream issue), but other than that, I don't think there is anything that needs doing here. @widoz Does that help ? Can I close this issue ? |
@jrfnl Thanks for the explanation. |
Hi,
Don't know if this is an issue or not. I'm new on this.
I encountered the following problem with this comment block:
So I changed it to :
And received the following message
The text was updated successfully, but these errors were encountered: