File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
SlevomatCodingStandard/Sniffs/Commenting Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -42,13 +42,24 @@ public function register(): array
4242 */
4343 public function process (File $ phpcsFile , $ commentPointer ): void
4444 {
45+ $ tokens = $ phpcsFile ->getTokens ();
46+
47+ if ($ tokens [$ commentPointer ]['column ' ] === 1 ) {
48+ return ;
49+ }
50+
4551 $ firstNonWhitespacePointerOnLine = TokenHelper::findFirstNonWhitespaceOnLine ($ phpcsFile , $ commentPointer );
4652
4753 if ($ firstNonWhitespacePointerOnLine === $ commentPointer ) {
4854 return ;
4955 }
5056
51- $ tokens = $ phpcsFile ->getTokens ();
57+ if (
58+ $ tokens [$ firstNonWhitespacePointerOnLine ]['code ' ] === T_DOC_COMMENT_OPEN_TAG
59+ && $ tokens [$ firstNonWhitespacePointerOnLine ]['comment_closer ' ] > $ commentPointer
60+ ) {
61+ return ;
62+ }
5263
5364 $ commentEndPointer = CommentHelper::getCommentEndPointer ($ phpcsFile , $ commentPointer );
5465 $ nextNonWhitespacePointer = TokenHelper::findNextNonWhitespace ($ phpcsFile , $ commentEndPointer + 1 );
Original file line number Diff line number Diff line change @@ -29,7 +29,21 @@ function () {
2929 */
3030class Whatever
3131{
32-
32+ public function doAnything ()
33+ {
34+ /*
35+ Comment
36+ */
37+ while (true ) {
38+
39+ }
40+ }
3341}
3442
3543$ match = Strings::match ($ address , /** @lang RegExp */ '~^regexp$~ ' );
44+
45+ /** phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps */
46+ class Something
47+ {
48+
49+ }
You can’t perform that action at this time.
0 commit comments