@@ -30,6 +30,7 @@ private static function atomic(Atomic $atomic, Codebase $codebase, int $level):
3030 return match (true ) {
3131 $ atomic instanceof Atomic \TList => self ::list ($ atomic , $ codebase , $ level ),
3232 $ atomic instanceof Atomic \TArray => self ::array ($ atomic , $ codebase , $ level ),
33+ $ atomic instanceof Atomic \TIterable => self ::iterable ($ atomic , $ codebase , $ level ),
3334 $ atomic instanceof Atomic \TClosure => self ::callable ($ atomic , $ codebase , $ level ),
3435 $ atomic instanceof Atomic \TCallable => self ::callable ($ atomic , $ codebase , $ level ),
3536 $ atomic instanceof Atomic \TClassString => self ::classString ($ atomic , $ codebase , $ level ),
@@ -40,6 +41,14 @@ private static function atomic(Atomic $atomic, Codebase $codebase, int $level):
4041 };
4142 }
4243
44+ private static function iterable (Atomic \TIterable $ atomic , Codebase $ codebase , int $ level ): string
45+ {
46+ $ key = self ::union ($ atomic ->type_params [0 ], $ codebase , $ level );
47+ $ val = self ::union ($ atomic ->type_params [1 ], $ codebase , $ level );
48+
49+ return "iterable<TKey: {$ key }, TValue: $ val> " ;
50+ }
51+
4352 private static function classString (Atomic \TClassString $ atomic , Codebase $ codebase , int $ level ): string
4453 {
4554 return null !== $ atomic ->as_type
@@ -57,23 +66,21 @@ private static function templateParam(Atomic\TTemplateParam $atomic, Codebase $c
5766
5867 private static function array (Atomic \TArray $ atomic , Codebase $ codebase , int $ level ): string
5968 {
60- $ types = implode (', ' , array_map (
61- fn (Union $ param ) => self ::union ($ param , $ codebase , $ level ),
62- $ atomic ->type_params
63- ));
69+ $ key = self ::union ($ atomic ->type_params [0 ], $ codebase , $ level );
70+ $ val = self ::union ($ atomic ->type_params [1 ], $ codebase , $ level );
6471
6572 return $ atomic instanceof Atomic \TNonEmptyArray
66- ? "non-empty-array< { $ types }> "
67- : "array< { $ types } > " ;
73+ ? "non-empty-array<TKey: { $ key } , TValue: { $ val }> "
74+ : "array<TKey: { $ key } , TValue: $ val > " ;
6875 }
6976
7077 private static function list (Atomic \TList $ atomic , Codebase $ codebase , int $ level ): string
7178 {
7279 $ type = self ::union ($ atomic ->type_param , $ codebase , $ level );
7380
7481 return $ atomic instanceof Atomic \TNonEmptyList
75- ? "non-empty-list< {$ type }> "
76- : "list< {$ type }> " ;
82+ ? "non-empty-list<TValue: {$ type }> "
83+ : "list<TValue: {$ type }> " ;
7784 }
7885
7986 private static function callable (Atomic \TClosure |Atomic \TCallable $ atomic , Codebase $ codebase , int $ level ): string
0 commit comments