File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -53,16 +53,23 @@ public function register()
5353 */
5454 public function process (File $ phpcsFile , $ stackPtr )
5555 {
56- $ tokens = $ phpcsFile ->getTokens ();
57- $ find = Tokens::$ methodPrefixes ;
58- $ find [T_WHITESPACE ] = T_WHITESPACE ;
59- $ find [T_READONLY ] = T_READONLY ;
56+ $ tokens = $ phpcsFile ->getTokens ();
57+ $ find = ([
58+ T_ABSTRACT => T_ABSTRACT ,
59+ T_FINAL => T_FINAL ,
60+ T_READONLY => T_READONLY ,
61+ T_WHITESPACE => T_WHITESPACE ,
62+ ] + Tokens::$ phpcsCommentTokens );
6063 $ name = $ tokens [$ stackPtr ]['content ' ];
6164 $ classCodeStart = $ stackPtr ;
6265
6366 $ previousContent = null ;
6467 for ($ commentEnd = ($ stackPtr - 1 ); $ commentEnd >= 0 ; $ commentEnd --) {
6568 if (isset ($ find [$ tokens [$ commentEnd ]['code ' ]]) === true ) {
69+ if (isset (Tokens::$ phpcsCommentTokens [$ tokens [$ commentEnd ]['code ' ]]) === true ) {
70+ $ classCodeStart = $ commentEnd ;
71+ }
72+
6673 continue ;
6774 }
6875
@@ -78,7 +85,7 @@ public function process(File $phpcsFile, $stackPtr)
7885 }
7986
8087 break ;
81- }
88+ }//end for
8289
8390 if ($ tokens [$ commentEnd ]['code ' ] !== T_DOC_COMMENT_CLOSE_TAG
8491 && $ tokens [$ commentEnd ]['code ' ] !== T_COMMENT
Original file line number Diff line number Diff line change @@ -1905,3 +1905,12 @@ public function __construct(
19051905 ) {}
19061906
19071907}
1908+
1909+ /**
1910+ * Doc block is here and an ignore directive is ok.
1911+ */
1912+ // phpcs:ignore Drupal.NamingConventions.ValidClassName
1913+ enum PUROSELY_WRONG_BUT_OK : int {
1914+ case One = 1 ;
1915+ case Two = 2 ;
1916+ }
You can’t perform that action at this time.
0 commit comments