Skip to content

Commit

Permalink
SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration: Fixed …
Browse files Browse the repository at this point in the history
…false positives for constants
  • Loading branch information
kukulich committed Oct 19, 2022
1 parent d4175d8 commit 4eeb22f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use const T_CLOSURE;
use const T_COALESCE_EQUAL;
use const T_COMMENT;
use const T_CONST;
use const T_DOC_COMMENT_OPEN_TAG;
use const T_EQUAL;
use const T_FN;
Expand Down Expand Up @@ -85,7 +86,11 @@ public function process(File $phpcsFile, $commentOpenPointer): void
);
} while (true);

if (in_array($tokens[$pointerAfterCommentClosePointer]['code'], [T_PRIVATE, T_PROTECTED, T_PUBLIC, T_READONLY], true)) {
if (in_array(
$tokens[$pointerAfterCommentClosePointer]['code'],
[T_PRIVATE, T_PROTECTED, T_PUBLIC, T_READONLY, T_CONST],
true
)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php // lint >= 8.1

/**
* @var string
*/
const BOO = 'boo';

class Foo
{

Expand Down

0 comments on commit 4eeb22f

Please sign in to comment.