@@ -107,6 +107,7 @@ private static function getTypeOfExpression(Tokens $tokens, int $assignmentIndex
107107 \assert (\is_int ($ semicolonIndex ));
108108
109109 $ beforeSemicolonIndex = $ tokens ->getPrevMeaningfulToken ($ semicolonIndex );
110+ \assert (\is_int ($ beforeSemicolonIndex ));
110111
111112 $ map = [
112113 \T_DNUMBER => [\T_STRING , 'float ' ],
@@ -118,11 +119,21 @@ private static function getTypeOfExpression(Tokens $tokens, int $assignmentIndex
118119 $ tokenId = $ tokens [$ beforeSemicolonIndex ]->getId ();
119120
120121 if ($ tokens [$ beforeSemicolonIndex ]->isGivenKind (\T_STRING )) {
121- return new Token ([\T_STRING , $ tokens [$ beforeSemicolonIndex ]->getContent ()]);
122+ $ lowercasedContent = \strtolower ($ tokens [$ beforeSemicolonIndex ]->getContent ());
123+ if (\in_array ($ lowercasedContent , ['false ' , 'true ' , 'null ' ], true )) {
124+ return new Token ([\T_STRING , $ tokens [$ beforeSemicolonIndex ]->getContent ()]);
125+ }
122126 }
123127
124128 if ($ tokenId === null && $ tokens [$ beforeSemicolonIndex ]->equals (') ' )) {
125- $ tokenId = CT ::T_ARRAY_SQUARE_BRACE_CLOSE ;
129+ $ openParenthesisIndex = $ tokens ->findBlockStart (Tokens::BLOCK_TYPE_PARENTHESIS_BRACE , $ beforeSemicolonIndex );
130+
131+ $ arrayIndex = $ tokens ->getPrevMeaningfulToken ($ openParenthesisIndex );
132+ \assert (\is_int ($ arrayIndex ));
133+
134+ if ($ tokens [$ arrayIndex ]->isGivenKind (\T_ARRAY )) {
135+ $ tokenId = CT ::T_ARRAY_SQUARE_BRACE_CLOSE ;
136+ }
126137 }
127138
128139 if (isset ($ map [$ tokenId ])) {
0 commit comments