@@ -2664,17 +2664,18 @@ static function (): void {
26642664 $ arrayArgNativeType = $ scope ->getNativeType ($ arrayArg );
26652665
26662666 $ isArrayPop = $ functionReflection ->getName () === 'array_pop ' ;
2667+ $ newType = $ isArrayPop ? $ arrayArgType ->popArray () : $ arrayArgType ->shiftArray ();
26672668 $ scope = $ scope ->invalidateExpression ($ arrayArg )->assignExpression (
26682669 $ arrayArg ,
2669- $ isArrayPop ? $ arrayArgType -> popArray () : $ arrayArgType -> shiftArray () ,
2670+ $ newType ,
26702671 $ isArrayPop ? $ arrayArgNativeType ->popArray () : $ arrayArgNativeType ->shiftArray (),
26712672 );
26722673
26732674 $ scope = $ this ->processAssignVar (
26742675 $ scope ,
26752676 $ stmt ,
26762677 $ arrayArg ,
2677- $ arrayArg ,
2678+ new TypeExpr ( $ newType ) ,
26782679 static function (Node $ node , Scope $ scope ) use ($ nodeCallback ): void {
26792680 if (!$ node instanceof PropertyAssignNode && !$ node instanceof VariableAssignNode) {
26802681 return ;
@@ -2703,7 +2704,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
27032704 $ scope ,
27042705 $ stmt ,
27052706 $ arrayArg ,
2706- $ arrayArg ,
2707+ new TypeExpr ( $ arrayType ) ,
27072708 static function (Node $ node , Scope $ scope ) use ($ nodeCallback ): void {
27082709 if (!$ node instanceof PropertyAssignNode && !$ node instanceof VariableAssignNode) {
27092710 return ;
@@ -2729,17 +2730,18 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
27292730 && $ functionReflection ->getName () === 'shuffle '
27302731 ) {
27312732 $ arrayArg = $ expr ->getArgs ()[0 ]->value ;
2733+ $ newType = $ scope ->getType ($ arrayArg )->shuffleArray ();
27322734 $ scope = $ scope ->assignExpression (
27332735 $ arrayArg ,
2734- $ scope -> getType ( $ arrayArg )-> shuffleArray () ,
2736+ $ newType ,
27352737 $ scope ->getNativeType ($ arrayArg )->shuffleArray (),
27362738 );
27372739
27382740 $ scope = $ this ->processAssignVar (
27392741 $ scope ,
27402742 $ stmt ,
27412743 $ arrayArg ,
2742- $ arrayArg ,
2744+ new TypeExpr ( $ newType ) ,
27432745 static function (Node $ node , Scope $ scope ) use ($ nodeCallback ): void {
27442746 if (!$ node instanceof PropertyAssignNode && !$ node instanceof VariableAssignNode) {
27452747 return ;
@@ -2766,17 +2768,18 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
27662768 $ lengthType = isset ($ expr ->getArgs ()[2 ]) ? $ scope ->getType ($ expr ->getArgs ()[2 ]->value ) : new NullType ();
27672769 $ replacementType = isset ($ expr ->getArgs ()[3 ]) ? $ scope ->getType ($ expr ->getArgs ()[3 ]->value ) : new ConstantArrayType ([], []);
27682770
2771+ $ newType = $ arrayArgType ->spliceArray ($ offsetType , $ lengthType , $ replacementType );
27692772 $ scope = $ scope ->invalidateExpression ($ arrayArg )->assignExpression (
27702773 $ arrayArg ,
2771- $ arrayArgType -> spliceArray ( $ offsetType , $ lengthType , $ replacementType ) ,
2774+ $ newType ,
27722775 $ arrayArgNativeType ->spliceArray ($ offsetType , $ lengthType , $ replacementType ),
27732776 );
27742777
27752778 $ scope = $ this ->processAssignVar (
27762779 $ scope ,
27772780 $ stmt ,
27782781 $ arrayArg ,
2779- $ arrayArg ,
2782+ new TypeExpr ( $ newType ) ,
27802783 static function (Node $ node , Scope $ scope ) use ($ nodeCallback ): void {
27812784 if (!$ node instanceof PropertyAssignNode && !$ node instanceof VariableAssignNode) {
27822785 return ;
@@ -2796,17 +2799,18 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
27962799 && count ($ expr ->getArgs ()) >= 1
27972800 ) {
27982801 $ arrayArg = $ expr ->getArgs ()[0 ]->value ;
2802+ $ newType = $ this ->getArraySortPreserveListFunctionType ($ scope ->getType ($ arrayArg ));
27992803 $ scope = $ scope ->assignExpression (
28002804 $ arrayArg ,
2801- $ this -> getArraySortPreserveListFunctionType ( $ scope -> getType ( $ arrayArg )) ,
2805+ $ newType ,
28022806 $ this ->getArraySortPreserveListFunctionType ($ scope ->getNativeType ($ arrayArg )),
28032807 );
28042808
28052809 $ scope = $ this ->processAssignVar (
28062810 $ scope ,
28072811 $ stmt ,
28082812 $ arrayArg ,
2809- $ arrayArg ,
2813+ new TypeExpr ( $ newType ) ,
28102814 static function (Node $ node , Scope $ scope ) use ($ nodeCallback ): void {
28112815 if (!$ node instanceof PropertyAssignNode && !$ node instanceof VariableAssignNode) {
28122816 return ;
@@ -2826,17 +2830,18 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
28262830 && count ($ expr ->getArgs ()) >= 1
28272831 ) {
28282832 $ arrayArg = $ expr ->getArgs ()[0 ]->value ;
2833+ $ newType = $ this ->getArraySortDoNotPreserveListFunctionType ($ scope ->getType ($ arrayArg ));
28292834 $ scope = $ scope ->assignExpression (
28302835 $ arrayArg ,
2831- $ this -> getArraySortDoNotPreserveListFunctionType ( $ scope -> getType ( $ arrayArg )) ,
2836+ $ newType ,
28322837 $ this ->getArraySortDoNotPreserveListFunctionType ($ scope ->getNativeType ($ arrayArg )),
28332838 );
28342839
28352840 $ scope = $ this ->processAssignVar (
28362841 $ scope ,
28372842 $ stmt ,
28382843 $ arrayArg ,
2839- $ arrayArg ,
2844+ new TypeExpr ( $ newType ) ,
28402845 static function (Node $ node , Scope $ scope ) use ($ nodeCallback ): void {
28412846 if (!$ node instanceof PropertyAssignNode && !$ node instanceof VariableAssignNode) {
28422847 return ;
0 commit comments