Skip to content

Commit 5aee21a

Browse files
Simplify
1 parent 2407895 commit 5aee21a

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

src/Analyser/ExprHandler/AssignHandler.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -961,34 +961,21 @@ private function processArrayByRefItems(MutatingScope $scope, string $rootVarNam
961961
$dimExpr = $arrayItem->key;
962962
} elseif ($implicitIndex !== null) {
963963
$dimExpr = new Node\Scalar\Int_($implicitIndex);
964+
$implicitIndex++;
964965
} else {
965-
$dimExpr = null;
966+
continue;
966967
}
967968

968-
if ($arrayItem->value instanceof Expr\Array_ && $dimExpr !== null) {
969+
if ($arrayItem->value instanceof Expr\Array_) {
969970
$dimFetchExpr = new ArrayDimFetch($parentExpr, $dimExpr);
970971
$scope = $this->processArrayByRefItems($scope, $rootVarName, $arrayItem->value, $dimFetchExpr);
971972
}
972973

973974
if (!$arrayItem->byRef || !$arrayItem->value instanceof Variable || !is_string($arrayItem->value->name)) {
974-
if ($arrayItem->key === null && $implicitIndex !== null) {
975-
$implicitIndex++;
976-
}
977-
continue;
978-
}
979-
980-
if ($dimExpr === null) {
981-
if ($arrayItem->key === null && $implicitIndex !== null) {
982-
$implicitIndex++;
983-
}
984975
continue;
985976
}
986977

987978
$refVarName = $arrayItem->value->name;
988-
if ($arrayItem->key === null && $implicitIndex !== null) {
989-
$implicitIndex++;
990-
}
991-
992979
$dimFetchExpr = new ArrayDimFetch($parentExpr, $dimExpr);
993980
$refType = $scope->getType(new Variable($refVarName));
994981
$refNativeType = $scope->getNativeType(new Variable($refVarName));

0 commit comments

Comments
 (0)