File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2879,7 +2879,8 @@ public function unsetExpression(Expr $expr): self
28792879 $ nativeTypes
28802880 );
28812881 } elseif ($ expr instanceof Expr \ArrayDimFetch && $ expr ->dim !== null ) {
2882- $ constantArrays = TypeUtils::getConstantArrays ($ this ->getType ($ expr ->var ));
2882+ $ varType = $ this ->getType ($ expr ->var );
2883+ $ constantArrays = TypeUtils::getConstantArrays ($ varType );
28832884 if (count ($ constantArrays ) > 0 ) {
28842885 $ unsetArrays = [];
28852886 $ dimType = $ this ->getType ($ expr ->dim );
@@ -2894,7 +2895,13 @@ public function unsetExpression(Expr $expr): self
28942895
28952896 $ args = [new Node \Arg ($ expr ->var )];
28962897
2897- return $ this ->invalidateExpression ($ expr ->var )
2898+ $ arrays = TypeUtils::getArrays ($ varType );
2899+ $ scope = $ this ;
2900+ if (count ($ arrays ) > 0 ) {
2901+ $ scope = $ scope ->specifyExpressionType ($ expr ->var , TypeCombinator::union (...$ arrays ));
2902+ }
2903+
2904+ return $ scope ->invalidateExpression ($ expr ->var )
28982905 ->invalidateExpression (new FuncCall (new Name \FullyQualified ('count ' ), $ args ))
28992906 ->invalidateExpression (new FuncCall (new Name ('count ' ), $ args ));
29002907 }
You can’t perform that action at this time.
0 commit comments