File tree Expand file tree Collapse file tree 3 files changed +58
-1
lines changed Expand file tree Collapse file tree 3 files changed +58
-1
lines changed Original file line number Diff line number Diff line change 66
77use PHP_CodeSniffer \Files \File ;
88use PHP_CodeSniffer \Sniffs \Sniff ;
9+ use PHP_CodeSniffer \Util \Tokens ;
910use SymfonyCustom \Helpers \FixerHelper ;
1011use SymfonyCustom \Helpers \SniffHelper ;
1112
@@ -43,7 +44,11 @@ public function process(File $phpcsFile, $stackPtr): void
4344
4445 $ commentTagLine = $ tokens [$ commentTag ]['line ' ];
4546
46- $ previousString = $ phpcsFile ->findPrevious (T_DOC_COMMENT_STRING , $ commentTag , $ stackPtr );
47+ $ previousString = $ phpcsFile ->findPrevious (
48+ array_merge (Tokens::$ phpcsCommentTokens , [T_DOC_COMMENT_STRING ]),
49+ $ commentTag ,
50+ $ stackPtr
51+ );
4752 $ previousLine = -1 ;
4853
4954 if (false !== $ previousString ) {
Original file line number Diff line number Diff line change 7474 *
7575 * @param string $b
7676 */
77+
78+ /**
79+ * An override of Twig's Lexer to add whitespace and new line detection.
80+ *
81+ * Since the regex are using bytes as position, mb_ methods are voluntary not used.
82+ * phpcs:disable SymfonyCustom.PHP.EncourageMultiBytes
83+ *
84+ * @phpstan-type TokenizerOptions = array{
85+ * tag_comment: array{string, string},
86+ * tag_block: array{string, string},
87+ * tag_variable: array{string, string},
88+ * whitespace_trim: string,
89+ * whitespace_line_trim: string,
90+ * interpolation: array{string, string},
91+ * }
92+ * @phpstan-type Regex = array{
93+ * lex_block: string,
94+ * lex_comment: string,
95+ * lex_variable: string,
96+ * operator: string,
97+ * lex_tokens_start: string,
98+ * interpolation_start: string,
99+ * interpolation_end: string,
100+ * lex_block: string,
101+ * }
102+ */
Original file line number Diff line number Diff line change 7777 *
7878 * @param string $b
7979 */
80+
81+ /**
82+ * An override of Twig's Lexer to add whitespace and new line detection.
83+ *
84+ * Since the regex are using bytes as position, mb_ methods are voluntary not used.
85+ * phpcs:disable SymfonyCustom.PHP.EncourageMultiBytes
86+ *
87+ * @phpstan-type TokenizerOptions = array{
88+ * tag_comment: array{string, string},
89+ * tag_block: array{string, string},
90+ * tag_variable: array{string, string},
91+ * whitespace_trim: string,
92+ * whitespace_line_trim: string,
93+ * interpolation: array{string, string},
94+ * }
95+ * @phpstan-type Regex = array{
96+ * lex_block: string,
97+ * lex_comment: string,
98+ * lex_variable: string,
99+ * operator: string,
100+ * lex_tokens_start: string,
101+ * interpolation_start: string,
102+ * interpolation_end: string,
103+ * lex_block: string,
104+ * }
105+ */
You can’t perform that action at this time.
0 commit comments