diff --git a/src/Param/ParamValueConverterRegistry.php b/src/Param/ParamValueConverterRegistry.php index e764f8e..0da90e8 100644 --- a/src/Param/ParamValueConverterRegistry.php +++ b/src/Param/ParamValueConverterRegistry.php @@ -161,7 +161,11 @@ public function __construct() ? $v : sprintf('[%s]', implode( ',', - array_map(fn (mixed $v) => $this->get($type->params)($v, $type, true), $v), + array_map(function (mixed $v) use ($type) { + $innerType = Type::fromString($type->params); + + return $this->get($innerType)($v, $innerType, true); + }, $v), )), 'Tuple' => function (array|string $v, Type $type) { if (is_string($v)) { diff --git a/tests/Param/ParamValueConverterRegistryTest.php b/tests/Param/ParamValueConverterRegistryTest.php index 5c61571..27b78ff 100644 --- a/tests/Param/ParamValueConverterRegistryTest.php +++ b/tests/Param/ParamValueConverterRegistryTest.php @@ -110,7 +110,9 @@ public function testConvert(string $type, mixed $value, mixed $expected): void public static function providerConvert(): Generator { yield 'Array' => ['Array(String)', "['foo','bar']", "['foo','bar']"]; + yield 'Array LC' => ['Array(LowCardinality(String))', "['foo','bar']", "['foo','bar']"]; yield 'Array (array)' => ['Array(String)', ['foo', 'bar'], "['foo','bar']"]; + yield 'Array Tuple' => ['Array(Tuple(String, String))', [['foo', 'bar']], "[('foo','bar')]"]; yield 'Tuple' => ['Tuple(String, Int8)', "('k',1)", "('k',1)"]; yield 'Tuple (array)' => ['Tuple(String, Int8)', ['k', 1], "('k',1)"]; @@ -250,7 +252,7 @@ public static function providerConvert(): Generator yield 'IPv6' => ['IPv6', '2001:0000:130F:0000:0000:09C0:876A:130B', '2001:0:130f::9c0:876a:130b']; } - public function testThrowsOnUknownType(): void + public function testThrowsOnUnknownType(): void { $registry = new ParamValueConverterRegistry();