Skip to content

Commit cab1937

Browse files
committed
Iterate on SnakeCaseToCamelCaseConverter
haha, see what I did there?
1 parent f25ac8d commit cab1937

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/Firebase/Valinor/Converter/SnakeCaseToCamelCaseConverter.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Kreait\Firebase\Valinor\Converter;
66

7-
use Kreait\Firebase\Valinor\Source;
87
use Traversable;
98

109
/**
@@ -16,20 +15,16 @@ final class SnakeCaseToCamelCaseConverter
1615
{
1716
/**
1817
* @template T of object
19-
* @param Source|array<mixed> $values
20-
* @param callable(array<mixed>): T $next
18+
* @param iterable<mixed> $values
19+
* @param callable(iterable<mixed>): T $next
2120
* @return T
2221
*/
23-
public function __invoke(mixed $values, callable $next): object
22+
public function __invoke(iterable $values, callable $next): object
2423
{
2524
if ($values instanceof Traversable) {
2625
$values = iterator_to_array($values);
2726
}
2827

29-
if (!is_array($values)) {
30-
return $next($values);
31-
}
32-
3328
$camelCaseConverted = array_combine(
3429
array_map(
3530
fn(int|string $key): string => lcfirst(str_replace('_', '', ucwords((string) $key, '_'))),

0 commit comments

Comments
 (0)