File tree 3 files changed +58
-1
lines changed
3 files changed +58
-1
lines changed Original file line number Diff line number Diff line change 6
6
7
7
use PHP_CodeSniffer \Files \File ;
8
8
use PHP_CodeSniffer \Sniffs \Sniff ;
9
+ use PHP_CodeSniffer \Util \Tokens ;
9
10
use SymfonyCustom \Helpers \FixerHelper ;
10
11
use SymfonyCustom \Helpers \SniffHelper ;
11
12
@@ -43,7 +44,11 @@ public function process(File $phpcsFile, $stackPtr): void
43
44
44
45
$ commentTagLine = $ tokens [$ commentTag ]['line ' ];
45
46
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
+ );
47
52
$ previousLine = -1 ;
48
53
49
54
if (false !== $ previousString ) {
Original file line number Diff line number Diff line change 74
74
*
75
75
* @param string $b
76
76
*/
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 77
77
*
78
78
* @param string $b
79
79
*/
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