Skip to content

Commit 7dd98ac

Browse files
committed
Added better typing to paramaterhelper
1 parent 9abd547 commit 7dd98ac

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/ParameterHelper.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,34 @@
2929

3030
final class ParameterHelper
3131
{
32+
/**
33+
* @template T
34+
*
35+
* @param iterable<array-key, T> $iterable
36+
*
37+
* @return CypherList<T>
38+
*/
3239
public static function asList(iterable $iterable): CypherList
3340
{
3441
return new CypherList(new Vector($iterable));
3542
}
3643

44+
/**
45+
* @template T
46+
*
47+
* @param iterable<array-key, T> $iterable
48+
*
49+
* @return CypherMap<T>
50+
*/
3751
public static function asMap(iterable $iterable): CypherMap
3852
{
39-
return new CypherMap(new Map($iterable));
53+
/** @var Map<string, mixed> $map */
54+
$map = new Map();
55+
foreach ($iterable as $key => $value) {
56+
$map->put((string) $key, $value);
57+
}
58+
59+
return new CypherMap($map);
4060
}
4161

4262
/**

0 commit comments

Comments
 (0)