@@ -73,7 +73,16 @@ public static function resolveDataProvider(): iterable
7373 yield [Type::callable (), 'callable(string, int): mixed ' ];
7474
7575 // array
76- yield [Type::list (Type::bool ()), 'bool[] ' ];
76+ yield [Type::array (Type::bool ()), 'bool[] ' ];
77+ yield [Type::array (Type::bool ()), 'array<bool> ' ];
78+ yield [Type::array (Type::bool (), Type::int ()), 'array<int, bool> ' ];
79+ yield [Type::array (Type::bool (), Type::arrayKey ()), 'array<array-key, bool> ' ];
80+ yield [Type::array (Type::bool (), Type::arrayKey ()), 'array<int|string, bool> ' ];
81+ yield [Type::array (Type::bool (), Type::arrayKey ()), 'non-empty-array<int|string, bool> ' ];
82+
83+ // list
84+ yield [Type::list (Type::bool ()), 'list<bool> ' ];
85+ yield [Type::list (Type::bool ()), 'non-empty-list<bool> ' ];
7786
7887 // array shape
7988 yield [Type::arrayShape (['foo ' => Type::true (), 1 => Type::false ()]), 'array{foo: true, 1: false} ' ];
@@ -253,4 +262,28 @@ public function testCannotResolveValueOfInvalidType()
253262 $ this ->expectException (UnsupportedException::class);
254263 $ this ->resolver ->resolve ('value-of<int> ' );
255264 }
265+
266+ public function testCannotResolveListWithKeyType ()
267+ {
268+ $ this ->expectException (UnsupportedException::class);
269+ $ this ->resolver ->resolve ('list<int, string> ' );
270+ }
271+
272+ public function testCannotResolveInvalidNonEmptyListWithKeyType ()
273+ {
274+ $ this ->expectException (UnsupportedException::class);
275+ $ this ->resolver ->resolve ('non-empty-list<int, string> ' );
276+ }
277+
278+ public function testCannotResolveInvalidArrayKeyType ()
279+ {
280+ $ this ->expectException (InvalidArgumentException::class);
281+ $ this ->resolver ->resolve ('array<mixed, string> ' );
282+ }
283+
284+ public function testCannotResolveInvalidUnionArrayKeyType ()
285+ {
286+ $ this ->expectException (InvalidArgumentException::class);
287+ $ this ->resolver ->resolve ('array<int|mixed, string> ' );
288+ }
256289}
0 commit comments