1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Allow int offsets to be treated as keys

This commit is contained in:
Matthew Brown 2016-12-10 15:01:59 -05:00
parent 12b5097fba
commit c3df70e634

View File

@ -919,7 +919,8 @@ class ExpressionChecker
array $aliased_classes
) {
if ($stmt instanceof PhpParser\Node\Expr\ArrayDimFetch &&
$stmt->dim instanceof PhpParser\Node\Scalar\String_
($stmt->dim instanceof PhpParser\Node\Scalar\String_ ||
$stmt->dim instanceof PhpParser\Node\Scalar\LNumber)
) {
$root_var_id = self::getArrayVarId($stmt->var, $this_class_name, $namespace, $aliased_classes);
return $root_var_id ? $root_var_id . '[\'' . $stmt->dim->value . '\']' : null;