Passed
Push — master ( 98efde...7096b5 )
by Maxim
02:27
created
src/WS/Utils/Collections/HashMap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 
23 23
     public function getIterator()
24 24
     {
25
-        return new ArrayIterator(array_map(static function (MapEntry $entry) {
25
+        return new ArrayIterator(array_map(static function(MapEntry $entry) {
26 26
             return $entry->getValue();
27 27
         }, $this->entries));
28 28
     }
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Comparators.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
      */
14 14
     public static function scalarComparator(): callable
15 15
     {
16
-        return static function ($a, $b) {
16
+        return static function($a, $b) {
17 17
             return $a <=> $b;
18 18
         };
19 19
     }
20 20
 
21 21
     public static function objectPropertyComparator(string $property): callable
22 22
     {
23
-        return static function ($a, $b) use ($property) {
23
+        return static function($a, $b) use ($property) {
24 24
             return ObjectFunctions::getPropertyValue($a, $property) <=> ObjectFunctions::getPropertyValue($b, $property);
25 25
         };
26 26
     }
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Aggregators.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 {
20 20
     public static function strImplode(string $delimiter = ''): Closure
21 21
     {
22
-        return static function (Collection $collection) use ($delimiter) {
22
+        return static function(Collection $collection) use ($delimiter) {
23 23
             return implode($delimiter, $collection->toArray());
24 24
         };
25 25
     }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
          * @param Collection $collection
35 35
          * @return float|int
36 36
          */
37
-        return static function (Collection $collection) {
37
+        return static function(Collection $collection) {
38 38
             $array = $collection->toArray();
39 39
 
40 40
             return array_sum($array) / count($array);
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public static function group(): Closure
49 49
     {
50
-        return static function (Collection $collection): Map {
51
-            $groupBy = self::groupBy(static function ($el) {
50
+        return static function(Collection $collection): Map {
51
+            $groupBy = self::groupBy(static function($el) {
52 52
                 return $el;
53 53
             });
54 54
             return $groupBy($collection);
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public static function groupByProperty(string $property): Closure
64 64
     {
65
-        return static function (Collection $collection) use ($property): Map {
66
-            $fGetValue = static function ($obj) use ($property) {
65
+        return static function(Collection $collection) use ($property): Map {
66
+            $fGetValue = static function($obj) use ($property) {
67 67
                 return ObjectFunctions::getPropertyValue($obj, $property);
68 68
             };
69 69
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 
75 75
     public static function groupBy(callable $f): Closure
76 76
     {
77
-        return static function (Collection $collection) use ($f): Map {
77
+        return static function(Collection $collection) use ($f): Map {
78 78
             $group = new HashMap();
79 79
             $collection
80 80
                 ->stream()
81
-                ->each(static function ($el) use ($group, $f) {
81
+                ->each(static function($el) use ($group, $f) {
82 82
                     $value = $f($el);
83 83
                     $count = 0;
84 84
                     if (($gCount = $group->get($value)) !== null) {
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Converters.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public static function toPropertyValue(string $name): Closure
19 19
     {
20
-        return static function ($obj) use ($name) {
20
+        return static function($obj) use ($name) {
21 21
             return ObjectFunctions::getPropertyValue($obj, $name);
22 22
         };
23 23
     }
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public static function toProperties(array $names): Closure
31 31
     {
32
-        return static function ($obj) use ($names) {
32
+        return static function($obj) use ($names) {
33 33
             $res = [];
34 34
             foreach ($names as $name) {
35 35
                 $res[$name] = ObjectFunctions::getPropertyValue($obj, $name);
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Consumers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 {
10 10
     public static function dump(): callable
11 11
     {
12
-        return static function ($el) {
12
+        return static function($el) {
13 13
             var_dump($el);
14 14
         };
15 15
     }
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Reorganizers.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     public static function shuffle(): Closure
19 19
     {
20
-        return static function (Collection $collection): Collection {
20
+        return static function(Collection $collection): Collection {
21 21
             $array = $collection->toArray();
22 22
             shuffle($array);
23 23
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public static function random(int $count = 1): Closure
34 34
     {
35
-        return static function (Collection $collection) use ($count): Collection {
35
+        return static function(Collection $collection) use ($count): Collection {
36 36
             /**
37 37
              * Collection
38 38
              */
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
             $generated = 0;
53 53
             $multiplicity = (int)round($collectionSize / $expectedCount);
54 54
 
55
-            $rangeRandomizer = static function () use ($multiplicity): int {
55
+            $rangeRandomizer = static function() use ($multiplicity): int {
56 56
                 return random_int(0, $multiplicity - 1);
57 57
             };
58 58
 
59
-            $trier = static function () use (& $generated, & $rest, $expectedCount, $rangeRandomizer): bool {
59
+            $trier = static function() use (& $generated, & $rest, $expectedCount, $rangeRandomizer): bool {
60 60
                 $rest--;
61 61
                 if ($generated === $expectedCount) {
62 62
                     return false;
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public static function chunk(int $size): Closure
87 87
     {
88
-        return static function (Collection $collection) use ($size): Collection {
88
+        return static function(Collection $collection) use ($size): Collection {
89 89
             $chunkCollection = self::collectionConstructor();
90 90
             $currentChunk = self::collectionConstructor();
91 91
             $pointer = $size;
92 92
             $collection
93 93
                 ->stream()
94
-                ->each(static function ($el) use ($size, $chunkCollection, & $currentChunk, & $pointer) {
94
+                ->each(static function($el) use ($size, $chunkCollection, & $currentChunk, & $pointer) {
95 95
                     $pointer--;
96 96
                     $currentChunk->add($el);
97 97
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public static function collapse(): Closure
114 114
     {
115
-        return static function (Collection $collection): Collection {
116
-            $flatIterable = static function (iterable $collection) use (& $flatIterable): array  {
115
+        return static function(Collection $collection): Collection {
116
+            $flatIterable = static function(iterable $collection) use (& $flatIterable): array  {
117 117
                 $res = [];
118 118
                 foreach ($collection as $item) {
119 119
                     if (is_iterable($item)) {
Please login to merge, or discard this patch.
src/WS/Utils/Collections/ImmutableList.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 
60 60
     public function removeAt(int $index)
61 61
     {
62
-       throw $this->createBlockingException();
62
+        throw $this->createBlockingException();
63 63
     }
64 64
 
65 65
     private function createBlockingException(): RuntimeException
Please login to merge, or discard this patch.
src/WS/Utils/Collections/RemoveTraverseTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
         if ($this->isEmpty()) {
13 13
             return false;
14 14
         }
15
-        $fMatch = static function ($tested) use ($element): bool {
15
+        $fMatch = static function($tested) use ($element): bool {
16 16
             return $tested === $element;
17 17
         };
18 18
         if ($element instanceof HashCodeAware) {
19
-            $fMatch = static function ($tested) use ($element): bool {
19
+            $fMatch = static function($tested) use ($element): bool {
20 20
                 if ($tested instanceof HashCodeAware) {
21 21
                     return $tested->getHashCode() === $element->getHashCode();
22 22
                 }
Please login to merge, or discard this patch.
src/WS/Utils/Collections/SerialStream.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function reorganize(callable $reorganizer): Stream
54 54
     {
55 55
         $reorganizedCollection = $reorganizer($this->list);
56
-        if (! $reorganizedCollection instanceof Collection) {
56
+        if (!$reorganizedCollection instanceof Collection) {
57 57
             throw new RuntimeException('Result set of reorganizer call must be instance of Collection interface');
58 58
         }
59 59
         $this->list = $reorganizedCollection;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $values = [];
125 125
         $map = [];
126
-        $this->each(static function ($el) use ($extractor, & $map, & $values) {
126
+        $this->each(static function($el) use ($extractor, & $map, & $values) {
127 127
             $value = $extractor($el);
128 128
             if (!is_scalar($value)) {
129 129
                 throw new RuntimeException('Only scalar value can be as result of sort extractor');
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
         $size = $this->list->size();
167 167
         /** @var ListSequence $list */
168 168
         $list = $this->list->copy();
169
-        $this->walk(static function ($head, $index) use ($list, $size) {
169
+        $this->walk(static function($head, $index) use ($list, $size) {
170 170
             $tailIndex = $size - $index - 1;
171 171
             $tail = $list->get($tailIndex);
172 172
             $list->set($tail, $index);
173 173
             $list->set($head, $tailIndex);
174
-        }, (int)($size/2));
174
+        }, (int)($size / 2));
175 175
         $this->list = $list;
176 176
 
177 177
         return $this;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     public function limit(int $count): Stream
304 304
     {
305 305
         $newCollection = $this->emptyList();
306
-        $this->walk(static function ($el) use ($newCollection) {
306
+        $this->walk(static function($el) use ($newCollection) {
307 307
             $newCollection->add($el);
308 308
         }, $count);
309 309
 
Please login to merge, or discard this patch.