File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -31,16 +31,23 @@ public static function getMethodReturnType(MethodReturnTypeProviderEvent $event)
3131 ->flatMap (fn ($ union ) => Psalm::asSingleAtomicOf (Type \Atomic \TKeyedArray::class, $ union ));
3232
3333 $ remapped = [];
34+ $ all_keys_defined = true ;
3435
3536 foreach ($ arg_type ->properties as $ key => $ type ) {
36- $ remapped [ $ key ] = yield Option::some ($ type )
37+ $ type = yield Option::some ($ type )
3738 ->flatMap (fn ($ union ) => Psalm::asSingleAtomicOf (Type \Atomic \TGenericObject::class, $ union ))
3839 ->flatMap (fn ($ generic ) => Psalm::getTypeParam ($ generic , StaticTypeInterface::class, position: 0 ));
40+
41+ if ($ type ->possibly_undefined ) {
42+ $ all_keys_defined = false ;
43+ }
44+
45+ $ remapped [$ key ] = $ type ;
3946 }
4047
4148 $ keyed_array = new Type \Atomic \TKeyedArray ($ remapped );
4249 $ keyed_array ->sealed = $ arg_type ->sealed ;
43- $ keyed_array ->is_list = $ arg_type ->is_list ;
50+ $ keyed_array ->is_list = $ all_keys_defined ? $ arg_type ->is_list : false ;
4451
4552 return new Type \Union ([
4653 new Type \Atomic \TGenericObject (StaticTypeInterface::class, [
You can’t perform that action at this time.
0 commit comments