2020use Psalm \Type \Union ;
2121
2222use function Fp \Callable \ctor ;
23+ use function Fp \Collection \contains ;
2324use function Fp \Collection \sequenceOptionT ;
2425use function Fp \Evidence \of ;
2526use function Fp \Evidence \proveTrue ;
@@ -31,6 +32,8 @@ public static function getFunctionIds(): array
3132 return [
3233 strtolower ('Fp\Collection\sequenceEither ' ),
3334 strtolower ('Fp\Collection\sequenceEitherT ' ),
35+ strtolower ('Fp\Collection\sequenceEitherMerged ' ),
36+ strtolower ('Fp\Collection\sequenceEitherMergedT ' ),
3437 ];
3538 }
3639
@@ -67,7 +70,12 @@ public static function getFunctionReturnType(FunctionReturnTypeProviderEvent $ev
6770 */
6871 private static function getInputTypeFromSequenceEither (FunctionReturnTypeProviderEvent $ event ): Option
6972 {
70- return proveTrue (strtolower ('Fp\Collection\sequenceEither ' ) === $ event ->getFunctionId ())
73+ $ isSequenceEither = contains ($ event ->getFunctionId (), [
74+ strtolower ('Fp\Collection\sequenceEither ' ),
75+ strtolower ('Fp\Collection\sequenceEitherMerged ' ),
76+ ]);
77+
78+ return proveTrue ($ isSequenceEither )
7179 ->flatMap (fn () => PsalmApi::$ args ->getCallArgs ($ event ))
7280 ->flatMap (fn ($ args ) => $ args ->head ())
7381 ->flatMap (fn (CallArg $ arg ) => PsalmApi::$ types ->asSingleAtomic ($ arg ->type ))
@@ -79,7 +87,12 @@ private static function getInputTypeFromSequenceEither(FunctionReturnTypeProvide
7987 */
8088 private static function getInputTypeFromSequenceEitherT (FunctionReturnTypeProviderEvent $ event ): Option
8189 {
82- return proveTrue (strtolower ('Fp\Collection\sequenceEitherT ' ) === $ event ->getFunctionId ())
90+ $ isSequenceEitherT = contains ($ event ->getFunctionId (), [
91+ strtolower ('Fp\Collection\sequenceEitherT ' ),
92+ strtolower ('Fp\Collection\sequenceEitherMergedT ' ),
93+ ]);
94+
95+ return proveTrue ($ isSequenceEitherT )
8396 ->flatMap (fn () => PsalmApi::$ args ->getCallArgs ($ event ))
8497 ->flatMap (fn (ArrayList $ args ) => $ args ->toNonEmptyArrayList ())
8598 ->map (fn (NonEmptyArrayList $ args ) => new TKeyedArray (
0 commit comments