File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -97,9 +97,7 @@ public function process(File $phpcsFile, $stackPtr)
97
97
98
98
// If there is a phpstan-ignore inline comment disregard it and continue searching backwards
99
99
// to find the function comment.
100
- if ($ tokens [$ commentEnd ]['code ' ] === T_COMMENT
101
- && preg_match ('/\@phpstan-ignore/ ' , $ tokens [$ commentEnd ]['content ' ]) === 1
102
- ) {
100
+ if ($ this ->tokenIsPhpstanComment ($ tokens [$ commentEnd ]) === true ) {
103
101
$ functionCodeStart = $ commentEnd ;
104
102
continue ;
105
103
}
@@ -191,6 +189,20 @@ public function process(File $phpcsFile, $stackPtr)
191
189
}//end process()
192
190
193
191
192
+ /**
193
+ * Determine if a token is a '@phpstan-' control comment.
194
+ *
195
+ * @param array $token The token to be checked.
196
+ *
197
+ * @return bool True if the token contains a @phpstan comment.
198
+ */
199
+ public static function tokenIsPhpstanComment ($ token )
200
+ {
201
+ return ($ token ['code ' ] === T_COMMENT && strpos ($ token ['content ' ], ' @phpstan- ' ) !== false );
202
+
203
+ }//end tokenIsPhpstanComment()
204
+
205
+
194
206
/**
195
207
* Process the return comment of this function comment.
196
208
*
You can’t perform that action at this time.
0 commit comments