@@ -2134,11 +2134,12 @@ static function (): void {
2134
2134
) {
2135
2135
$ extractedArg = $ expr ->getArgs ()[0 ]->value ;
2136
2136
$ extractedType = $ scope ->getType ($ extractedArg );
2137
- if (count ($ extractedType ->getConstantArrays ()) > 0 ) {
2137
+ $ constantArrays = $ extractedType ->getConstantArrays ();
2138
+ if (count ($ constantArrays ) > 0 ) {
2138
2139
$ properties = [];
2139
2140
$ optionalProperties = [];
2140
2141
$ refCount = [];
2141
- foreach ($ extractedType -> getConstantArrays () as $ constantArray ) {
2142
+ foreach ($ constantArrays as $ constantArray ) {
2142
2143
foreach ($ constantArray ->getKeyTypes () as $ i => $ keyType ) {
2143
2144
if ($ keyType ->isString ()->no ()) {
2144
2145
// integers as variable names not allowed
@@ -2160,7 +2161,7 @@ static function (): void {
2160
2161
}
2161
2162
}
2162
2163
foreach ($ properties as $ name => $ type ) {
2163
- $ optional = in_array ($ name , $ optionalProperties , true ) || $ refCount [$ name ] < count ($ extractedType -> getConstantArrays () );
2164
+ $ optional = in_array ($ name , $ optionalProperties , true ) || $ refCount [$ name ] < count ($ constantArrays );
2164
2165
$ scope = $ scope ->assignVariable ($ name , $ type , $ type , $ optional ? TrinaryLogic::createMaybe () : TrinaryLogic::createYes ());
2165
2166
}
2166
2167
} else {
@@ -2995,8 +2996,9 @@ private function getArrayFunctionAppendingType(FunctionReflection $functionRefle
2995
2996
foreach ($ callArgs as $ callArg ) {
2996
2997
$ callArgType = $ scope ->getType ($ callArg ->value );
2997
2998
if ($ callArg ->unpack ) {
2998
- if (count ($ callArgType ->getConstantArrays ()) === 1 ) {
2999
- $ iterableValueTypes = $ callArgType ->getConstantArrays ()[0 ]->getValueTypes ();
2999
+ $ constantArrays = $ callArgType ->getConstantArrays ();
3000
+ if (count ($ constantArrays ) === 1 ) {
3001
+ $ iterableValueTypes = $ constantArrays [0 ]->getValueTypes ();
3000
3002
} else {
3001
3003
$ iterableValueTypes = [$ callArgType ->getIterableValueType ()];
3002
3004
$ nonConstantArrayWasUnpacked = true ;
0 commit comments