Skip to content

Commit 814d4a7

Browse files
authored
Merge pull request #76 from PHPCSStandards/php-8.3/generic-scopeindent-bugfix
PHP 8.3 | Generic/ScopeIndent: bug fix - missing defensive coding
2 parents b737635 + eeee4e6 commit 814d4a7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,8 +1090,11 @@ public function process(File $phpcsFile, $stackPtr)
10901090
if ($tokens[$i]['code'] === T_CONSTANT_ENCAPSED_STRING
10911091
|| $tokens[$i]['code'] === T_DOUBLE_QUOTED_STRING
10921092
) {
1093-
$i = $phpcsFile->findNext($tokens[$i]['code'], ($i + 1), null, true);
1094-
$i--;
1093+
$nextNonTextString = $phpcsFile->findNext($tokens[$i]['code'], ($i + 1), null, true);
1094+
if ($nextNonTextString !== false) {
1095+
$i = ($nextNonTextString - 1);
1096+
}
1097+
10951098
continue;
10961099
}
10971100

0 commit comments

Comments
 (0)