@@ -33,7 +33,7 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
3333
3434 $ valueType = $ scope ->getType ($ functionCall ->getArgs ()[1 ]->value );
3535 $ keysType = $ scope ->getType ($ functionCall ->getArgs ()[0 ]->value );
36- $ constantArrays = TypeUtils::getConstantArrays ($ keysType );
36+ $ constantArrays = TypeUtils::getOldConstantArrays ($ keysType );
3737 if (count ($ constantArrays ) === 0 ) {
3838 if ($ keysType ->isArray ()->yes ()) {
3939 $ itemType = $ keysType ->getIterableValueType ();
@@ -53,15 +53,15 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
5353 $ arrayTypes = [];
5454 foreach ($ constantArrays as $ constantArray ) {
5555 $ arrayBuilder = ConstantArrayTypeBuilder::createEmpty ();
56- foreach ($ constantArray ->getValueTypes () as $ keyType ) {
56+ foreach ($ constantArray ->getValueTypes () as $ i => $ keyType ) {
5757 if ((new IntegerType ())->isSuperTypeOf ($ keyType )->no ()) {
5858 if ($ keyType ->toString () instanceof ErrorType) {
5959 return new NeverType ();
6060 }
6161
62- $ arrayBuilder ->setOffsetValueType ($ keyType ->toString (), $ valueType );
62+ $ arrayBuilder ->setOffsetValueType ($ keyType ->toString (), $ valueType, $ constantArray -> isOptionalKey ( $ i ) );
6363 } else {
64- $ arrayBuilder ->setOffsetValueType ($ keyType , $ valueType );
64+ $ arrayBuilder ->setOffsetValueType ($ keyType , $ valueType, $ constantArray -> isOptionalKey ( $ i ) );
6565 }
6666 }
6767 $ arrayTypes [] = $ arrayBuilder ->getArray ();
0 commit comments