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)
9797
9898 // If there is a phpstan-ignore inline comment disregard it and continue searching backwards
9999 // 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 ) {
103101 $ functionCodeStart = $ commentEnd ;
104102 continue ;
105103 }
@@ -191,6 +189,20 @@ public function process(File $phpcsFile, $stackPtr)
191189 }//end process()
192190
193191
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+
194206 /**
195207 * Process the return comment of this function comment.
196208 *
You can’t perform that action at this time.
0 commit comments