Skip to content

Commit 6980f4b

Browse files
committed
Update
1 parent 050094e commit 6980f4b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Fixer/TypedClassConstantFixer.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ private static function fixClass(Tokens $tokens, int $openParenthesisIndex, int
8282
}
8383

8484
$constantNameIndex = $tokens->getNextMeaningfulToken($index);
85+
\assert(\is_int($constantNameIndex));
8586

8687
$assignmentIndex = $tokens->getNextMeaningfulToken($constantNameIndex);
88+
\assert(\is_int($assignmentIndex));
89+
8790
if (!$tokens[$assignmentIndex]->equals('=')) {
8891
continue;
8992
}
@@ -101,6 +104,8 @@ private static function fixClass(Tokens $tokens, int $openParenthesisIndex, int
101104
private static function getTypeOfExpression(Tokens $tokens, int $assignmentIndex): Token
102105
{
103106
$semicolonIndex = $tokens->getNextTokenOfKind($assignmentIndex, [';']);
107+
\assert(\is_int($semicolonIndex));
108+
104109
$beforeSemicolonIndex = $tokens->getPrevMeaningfulToken($semicolonIndex);
105110

106111
$map = [
@@ -116,7 +121,7 @@ private static function getTypeOfExpression(Tokens $tokens, int $assignmentIndex
116121
return new Token([\T_STRING, $tokens[$beforeSemicolonIndex]->getContent()]);
117122
}
118123

119-
if ($tokenId === null & $tokens[$beforeSemicolonIndex]->equals(')')) {
124+
if ($tokenId === null && $tokens[$beforeSemicolonIndex]->equals(')')) {
120125
$tokenId = CT::T_ARRAY_SQUARE_BRACE_CLOSE;
121126
}
122127

0 commit comments

Comments
 (0)