File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ public function process(File $phpcsFile, $stackPtr)
6363 $ name = $ tokens [$ stackPtr ]['content ' ];
6464 $ classCodeStart = $ stackPtr ;
6565
66- $ previousContent = null ;
6766 for ($ commentEnd = ($ stackPtr - 1 ); $ commentEnd >= 0 ; $ commentEnd --) {
6867 if (isset ($ find [$ tokens [$ commentEnd ]['code ' ]]) === true ) {
6968 if (isset (Tokens::$ phpcsCommentTokens [$ tokens [$ commentEnd ]['code ' ]]) === true ) {
@@ -73,10 +72,6 @@ public function process(File $phpcsFile, $stackPtr)
7372 continue ;
7473 }
7574
76- if ($ previousContent === null ) {
77- $ previousContent = $ commentEnd ;
78- }
79-
8075 if ($ tokens [$ commentEnd ]['code ' ] === T_ATTRIBUTE_END
8176 && isset ($ tokens [$ commentEnd ]['attribute_opener ' ]) === true
8277 ) {
Original file line number Diff line number Diff line change @@ -75,12 +75,16 @@ public function register()
7575 public function process (File $ phpcsFile , $ stackPtr )
7676 {
7777 $ tokens = $ phpcsFile ->getTokens ();
78- $ ignore = Tokens::$ methodPrefixes ;
78+ $ ignore = ( Tokens::$ methodPrefixes + Tokens:: $ phpcsCommentTokens ) ;
7979 $ ignore [T_WHITESPACE ] = T_WHITESPACE ;
8080 $ functionCodeStart = $ stackPtr ;
8181
8282 for ($ commentEnd = ($ stackPtr - 1 ); $ commentEnd >= 0 ; $ commentEnd --) {
8383 if (isset ($ ignore [$ tokens [$ commentEnd ]['code ' ]]) === true ) {
84+ if (isset (Tokens::$ phpcsCommentTokens [$ tokens [$ commentEnd ]['code ' ]]) === true ) {
85+ $ functionCodeStart = $ commentEnd ;
86+ }
87+
8488 continue ;
8589 }
8690
Original file line number Diff line number Diff line change @@ -1914,3 +1914,11 @@ enum PUROSELY_WRONG_BUT_OK: int {
19141914 case One = 1 ;
19151915 case Two = 2 ;
19161916}
1917+
1918+ /**
1919+ * Doc block is here and an ignore directive is ok.
1920+ */
1921+ // phpcs:ignore Drupal.NamingConventions.ValidClassName
1922+ function phpcs_ignore_comment () {
1923+
1924+ }
You can’t perform that action at this time.
0 commit comments