@@ -160,7 +160,7 @@ |
||
160 | 160 | * @param int $a |
161 | 161 | * @param int $b |
162 | 162 | * |
163 | - * @return bool |
|
163 | + * @return integer |
|
164 | 164 | */ |
165 | 165 | private function compare(int $a, int $b) |
166 | 166 | { |
@@ -282,7 +282,7 @@ |
||
282 | 282 | */ |
283 | 283 | private function siftUp(int $leaf) |
284 | 284 | { |
285 | - for (; $leaf > 0; $leaf = $parent) { |
|
285 | + for (; $leaf > 0; $leaf = $parent) { |
|
286 | 286 | |
287 | 287 | $parent = $this->parent($leaf); |
288 | 288 |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | return; |
237 | 237 | } |
238 | 238 | |
239 | - $swap = function (&$a, &$b) { |
|
239 | + $swap = function(&$a, &$b) { |
|
240 | 240 | $t = $a; |
241 | 241 | $a = $b; |
242 | 242 | $b = $t; |
243 | 243 | }; |
244 | 244 | |
245 | 245 | // Reverses a range within the internal array |
246 | - $reverse = function (int $a, int $b) use ($swap) { |
|
246 | + $reverse = function(int $a, int $b) use ($swap) { |
|
247 | 247 | while (--$b > $a) { |
248 | 248 | $swap($this->internal[$a++], $this->internal[$b--]); |
249 | 249 | } |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | if ($r > 0) { |
263 | - $reverse(0, $r); |
|
263 | + $reverse(0, $r); |
|
264 | 264 | $reverse($r, $n); |
265 | - $reverse(0, $n); |
|
265 | + $reverse(0, $n); |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Ds\Traits; |
3 | 3 | |
4 | +use Error; |
|
4 | 5 | use OutOfRangeException; |
5 | -use UnderflowException; |
|
6 | 6 | use Traversable; |
7 | -use Error; |
|
7 | +use UnderflowException; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Sequence |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function clear() |
45 | 45 | { |
46 | - $this->pairs = []; |
|
46 | + $this->pairs = []; |
|
47 | 47 | $this->capacity = self::MIN_CAPACITY; |
48 | 48 | } |
49 | 49 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | private function identical($a, $b): bool |
211 | 211 | { |
212 | - if (is_object($a) && $a instanceof Hashable){ |
|
212 | + if (is_object($a) && $a instanceof Hashable) { |
|
213 | 213 | return $a->equals($b); |
214 | 214 | } |
215 | 215 |
@@ -209,7 +209,7 @@ |
||
209 | 209 | */ |
210 | 210 | private function identical($a, $b): bool |
211 | 211 | { |
212 | - if (is_object($a) && $a instanceof Hashable){ |
|
212 | + if (is_object($a) && $a instanceof Hashable) { |
|
213 | 213 | return $a->equals($b); |
214 | 214 | } |
215 | 215 |
@@ -13,6 +13,7 @@ discard block |
||
13 | 13 | * object. The keys of either will not be preserved. |
14 | 14 | * |
15 | 15 | * @param array|\Traversable $values |
16 | + * @return void |
|
16 | 17 | */ |
17 | 18 | function __construct($values = null); |
18 | 19 | |
@@ -23,6 +24,7 @@ discard block |
||
23 | 24 | * @param int $capacity The number of values for which capacity should be |
24 | 25 | * allocated. Capacity will stay the same if this value |
25 | 26 | * is less than or equal to the current capacity. |
27 | + * @return void |
|
26 | 28 | */ |
27 | 29 | function allocate(int $capacity); |
28 | 30 | |
@@ -94,6 +96,7 @@ discard block |
||
94 | 96 | * @param mixed ...$values |
95 | 97 | * |
96 | 98 | * @throws \OutOfRangeException if the index is not in the range [0, n] |
99 | + * @return void |
|
97 | 100 | */ |
98 | 101 | function insert(int $index, ...$values); |
99 | 102 | |
@@ -148,6 +151,7 @@ discard block |
||
148 | 151 | * Adds zero or more values to the end of the sequence. |
149 | 152 | * |
150 | 153 | * @param mixed ...$values |
154 | + * @return void |
|
151 | 155 | */ |
152 | 156 | function push(...$values); |
153 | 157 | |
@@ -155,6 +159,7 @@ discard block |
||
155 | 159 | * Adds all values in an array or iterable object to the sequence. |
156 | 160 | * |
157 | 161 | * @param array|\Traversable $values |
162 | + * @return void |
|
158 | 163 | */ |
159 | 164 | function pushAll($values); |
160 | 165 | |
@@ -195,6 +200,7 @@ discard block |
||
195 | 200 | * positive, or 'pop' and 'unshift' if negative. |
196 | 201 | * |
197 | 202 | * @param int $rotations The number of rotations (can be negative). |
203 | + * @return void |
|
198 | 204 | */ |
199 | 205 | function rotate(int $rotations); |
200 | 206 | |
@@ -205,6 +211,7 @@ discard block |
||
205 | 211 | * @param mixed $value |
206 | 212 | * |
207 | 213 | * @throws \OutOfRangeException if the index is not in the range [0, size-1] |
214 | + * @return void |
|
208 | 215 | */ |
209 | 216 | function set(int $index, $value); |
210 | 217 | |
@@ -255,6 +262,7 @@ discard block |
||
255 | 262 | * Adds zero or more values to the front of the sequence. |
256 | 263 | * |
257 | 264 | * @param mixed ...$values |
265 | + * @return void |
|
258 | 266 | */ |
259 | 267 | function unshift(...$values); |
260 | 268 | } |