Skip to content

Commit 72e509b

Browse files
committed
fix cs complaints
1 parent 46b0c54 commit 72e509b

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/Flatten.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ class Flatten
1414

1515
/**
1616
* Flattens a variable, possibly traversable, into a one-dimensional array, recursively.
17-
*
17+
*
1818
* Each key (fully-qualified key or FQK) in the returned one-dimensional array is the join of all keys leading to
1919
* each (non-traversable) value, in all dimensions, separated by a given separator.
20-
*
20+
*
2121
* An initial prefix can be optionally provided, but it will not be separated with the specified separator.
22-
*
22+
*
2323
* @param mixed $var
2424
* @param string $separator
2525
* @param string $prefix
2626
* @param int $flags
27-
* @return array One-dimensional array containing all values from all possible traversable dimensions in given input.
27+
* @return array 1-dimensional array containing all values from all possible traversable dimensions in given input.
2828
* @see Flatten::FLAG_NUMERIC_NOT_FLATTENED
2929
*/
3030
public static function flatten($var, $separator = '.', $prefix = '', $flags = 0)
@@ -35,8 +35,8 @@ public static function flatten($var, $separator = '.', $prefix = '', $flags = 0)
3535
}
3636
return $flattened;
3737
}
38-
39-
private static function flattenGenerator($var, $separator, $prefix = '', $flags)
38+
39+
private static function flattenGenerator($var, $separator, $prefix = '', $flags = 0)
4040
{
4141
if (!self::canTraverse($var)) {
4242
yield $prefix => $var;
@@ -66,7 +66,7 @@ private static function canTraverse($var)
6666
private static function filterNumericKeysAndGetValues($var)
6767
{
6868
$values = [];
69-
$var = array_filter($var, function($value, $key) use (&$values) {
69+
$var = array_filter($var, function ($value, $key) use (&$values) {
7070
if (is_int($key)) {
7171
$values[$key] = $value;
7272
return false;

test/FlattenTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Sarhan\Flatten\Test;
4+
35
use PHPUnit\Framework\TestCase;
46
use Sarhan\Flatten;
57

@@ -98,7 +100,11 @@ public function traversablesProvider()
98100
[ 'a' => 1, '0' => 2, 'b.0' => 3, 'b.c' => 4 ]
99101
],
100102
[
101-
new \ArrayIterator([ 'a' => 1, 'b' => 2, 'c' => [ 'd' => [ 3, 4 ], 'e' => new \ArrayIterator([ 'f' => 5, 'g' => 6 ]) ] ]),
103+
new \ArrayIterator([
104+
'a' => 1,
105+
'b' => 2,
106+
'c' => [ 'd' => [ 3, 4 ], 'e' => new \ArrayIterator([ 'f' => 5, 'g' => 6 ]) ]
107+
]),
102108
[ 'a' => 1, 'b' => 2, 'c.d.0' => 3, 'c.d.1' => 4, 'c.e.f' => 5, 'c.e.g' => 6 ]
103109
]
104110
];
@@ -133,7 +139,11 @@ public function traversablesSeparatorPrefixProvider()
133139
[ 'local/a' => 1, 'local/0' => 2, 'local/b/0' => 3, 'local/b/c' => 4 ]
134140
],
135141
[
136-
new \ArrayIterator([ 'a' => 1, 'b' => 2, 'c' => [ 'd' => [ 3, 4 ], 'e' => new \ArrayIterator([ 'f' => 5, 'g' => 6 ]) ] ]),
142+
new \ArrayIterator([
143+
'a' => 1,
144+
'b' => 2,
145+
'c' => [ 'd' => [ 3, 4 ], 'e' => new \ArrayIterator([ 'f' => 5, 'g' => 6 ]) ]
146+
]),
137147
'',
138148
':',
139149
[ ':a' => 1, ':b' => 2, ':cd0' => 3, ':cd1' => 4, ':cef' => 5, ':ceg' => 6 ]

0 commit comments

Comments
 (0)