@@ -113,7 +113,7 @@ private function collectLongLinesData(File $file, int $start): array
113
113
for ($ i = $ start ; $ i < $ file ->numTokens ; $ i ++) {
114
114
// Still processing previous line: increment length and continue.
115
115
if ($ lastLine && ($ tokens [$ i ]['line ' ] === $ lastLine )) {
116
- $ content = (string )$ tokens [$ i ]['content ' ];
116
+ $ content = (string ) $ tokens [$ i ]['content ' ];
117
117
$ data [$ lastLine ]['length ' ] += strlen ($ content );
118
118
$ data [$ lastLine ]['nonEmptyLength ' ] += strlen (trim ($ content ));
119
119
continue ;
@@ -124,8 +124,8 @@ private function collectLongLinesData(File $file, int $start): array
124
124
$ data [$ lastLine ]['end ' ] = $ i - 1 ;
125
125
}
126
126
127
- $ lastLine = (int )$ tokens [$ i ]['line ' ];
128
- $ content = (string )$ tokens [$ i ]['content ' ];
127
+ $ lastLine = (int ) $ tokens [$ i ]['line ' ];
128
+ $ content = (string ) $ tokens [$ i ]['content ' ];
129
129
$ data [$ lastLine ] = [
130
130
'length ' => strlen ($ content ),
131
131
'nonEmptyLength ' => strlen (trim ($ content )),
@@ -228,7 +228,7 @@ private function isLongHtmlAttribute(
228
228
$ inPhp = true ;
229
229
}
230
230
if ($ tokens [$ i ]['code ' ] === T_INLINE_HTML || $ inPhp ) {
231
- $ tokenContent = (string )$ tokens [$ i ]['content ' ];
231
+ $ tokenContent = (string ) $ tokens [$ i ]['content ' ];
232
232
$ content .= $ inPhp ? str_repeat ('x ' , strlen ($ tokenContent )) : $ tokenContent ;
233
233
}
234
234
if ($ tokens [$ i ]['code ' ] === T_CLOSE_TAG && $ inPhp ) {
@@ -271,7 +271,12 @@ private function isLongSingleWord(
271
271
array $ tokens
272
272
): bool {
273
273
274
- $ words = preg_split ('~\s+~ ' , (string )$ tokens [$ position ]['content ' ], 2 , PREG_SPLIT_NO_EMPTY );
274
+ $ words = preg_split (
275
+ '~\s+~ ' ,
276
+ (string ) $ tokens [$ position ]['content ' ],
277
+ 2 ,
278
+ PREG_SPLIT_NO_EMPTY
279
+ );
275
280
276
281
// If multiple words exceed line limit, we can split each word in its own line
277
282
if ($ words === false || count ($ words ) !== 1 ) {
@@ -281,7 +286,7 @@ private function isLongSingleWord(
281
286
$ word = reset ($ words );
282
287
$ firstNonWhitePos = $ file ->findNext (T_WHITESPACE , $ position , $ lineEnd , true );
283
288
$ firstNonWhite = ($ firstNonWhitePos === false ) ? null : $ tokens [$ firstNonWhitePos ];
284
- $ tolerance = is_array ($ firstNonWhite ) ? ((int )($ firstNonWhite ['column ' ] ?? 1 ) + 3 ) : 4 ;
289
+ $ tolerance = is_array ($ firstNonWhite ) ? ((int ) ($ firstNonWhite ['column ' ] ?? 1 ) + 3 ) : 4 ;
285
290
286
291
return (strlen ($ word ) + $ tolerance ) > $ this ->lineLimit ;
287
292
}
@@ -320,7 +325,7 @@ private function isLongI10nFunction(File $file, array $tokens, int $start, int $
320
325
return false ;
321
326
}
322
327
323
- $ function = strtolower ((string )$ tokens [$ functionPos ]['content ' ]);
328
+ $ function = strtolower ((string ) $ tokens [$ functionPos ]['content ' ]);
324
329
if (!in_array ($ function , self ::I18N_FUNCTIONS , true )) {
325
330
return false ;
326
331
}
@@ -333,7 +338,7 @@ private function isLongI10nFunction(File $file, array $tokens, int $start, int $
333
338
if ($ tokens [$ i ]['line ' ] !== $ targetLine ) {
334
339
continue ;
335
340
}
336
- $ textLen += max (1 , strlen ((string )$ tokens [$ i ]['content ' ]));
341
+ $ textLen += max (1 , strlen ((string ) $ tokens [$ i ]['content ' ]));
337
342
}
338
343
339
344
return ($ textLen + 2 ) > $ this ->lineLimit ;
@@ -360,7 +365,7 @@ private function isLongUse(File $file, array $tokens, int $start, int $end): boo
360
365
$ endUse = $ file ->findEndOfStatement ($ usePos );
361
366
$ useLen = 0 ;
362
367
for ($ i = $ usePos ; $ i <= $ endUse ; $ i ++) {
363
- $ useLen += strlen ((string )$ tokens [$ i ]['content ' ]);
368
+ $ useLen += strlen ((string ) $ tokens [$ i ]['content ' ]);
364
369
}
365
370
366
371
return $ useLen > $ this ->lineLimit ;
0 commit comments