@@ -239,8 +239,12 @@ |
||
239 | 239 | { |
240 | 240 | $n = count($this); |
241 | 241 | |
242 | - if ($n < 2) return 0; |
|
243 | - if ($r < 0) return $n - (abs($r) % $n); |
|
242 | + if ($n < 2) { |
|
243 | + return 0; |
|
244 | + } |
|
245 | + if ($r < 0) { |
|
246 | + return $n - (abs($r) % $n); |
|
247 | + } |
|
244 | 248 | |
245 | 249 | return $r % $n; |
246 | 250 | } |
@@ -16,6 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | /** |
18 | 18 | * Removes all values from the collection. |
19 | + * @return void |
|
19 | 20 | */ |
20 | 21 | function clear(); |
21 | 22 |
@@ -22,6 +22,7 @@ discard block |
||
22 | 22 | * @param int $capacity The number of values for which capacity should be |
23 | 23 | * allocated. Capacity will stay the same if this value |
24 | 24 | * is less than or equal to the current capacity. |
25 | + * @return void |
|
25 | 26 | */ |
26 | 27 | function allocate(int $capacity); |
27 | 28 | |
@@ -32,6 +33,7 @@ discard block |
||
32 | 33 | * @param callable $callback Accepts the value, returns the new value. |
33 | 34 | * |
34 | 35 | * @psalm-param callable(TValue): TValue $callback |
36 | + * @return void |
|
35 | 37 | */ |
36 | 38 | function apply(callable $callback); |
37 | 39 | |
@@ -113,6 +115,7 @@ discard block |
||
113 | 115 | * @throws \OutOfRangeException if the index is not in the range [0, n] |
114 | 116 | * |
115 | 117 | * @psalm-param TValue ...$values |
118 | + * @return void |
|
116 | 119 | */ |
117 | 120 | function insert(int $index, ...$values); |
118 | 121 | |
@@ -177,6 +180,7 @@ discard block |
||
177 | 180 | * @param mixed ...$values |
178 | 181 | * |
179 | 182 | * @psalm-param TValue ...$values |
183 | + * @return void |
|
180 | 184 | */ |
181 | 185 | function push(...$values); |
182 | 186 | |
@@ -213,6 +217,7 @@ discard block |
||
213 | 217 | |
214 | 218 | /** |
215 | 219 | * Reverses the sequence in-place. |
220 | + * @return void |
|
216 | 221 | */ |
217 | 222 | function reverse(); |
218 | 223 | |
@@ -231,6 +236,7 @@ discard block |
||
231 | 236 | * positive, or 'pop' and 'unshift' if negative. |
232 | 237 | * |
233 | 238 | * @param int $rotations The number of rotations (can be negative). |
239 | + * @return void |
|
234 | 240 | */ |
235 | 241 | function rotate(int $rotations); |
236 | 242 | |
@@ -242,6 +248,7 @@ discard block |
||
242 | 248 | * @throws \OutOfRangeException if the index is not in the range [0, size-1] |
243 | 249 | * |
244 | 250 | * @psalm-param TValue $value |
251 | + * @return void |
|
245 | 252 | */ |
246 | 253 | function set(int $index, $value); |
247 | 254 | |
@@ -288,6 +295,7 @@ discard block |
||
288 | 295 | * Should return the result of a <=> b. |
289 | 296 | * |
290 | 297 | * @psalm-param (callable(TValue, TValue): int)|null $comparator |
298 | + * @return void |
|
291 | 299 | */ |
292 | 300 | function sort(callable $comparator = null); |
293 | 301 | |
@@ -325,6 +333,7 @@ discard block |
||
325 | 333 | * @param mixed ...$values |
326 | 334 | * |
327 | 335 | * @psalm-param TValue ...$values |
336 | + * @return void |
|
328 | 337 | */ |
329 | 338 | function unshift(...$values); |
330 | 339 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | * |
40 | 40 | * @param mixed $name |
41 | 41 | * |
42 | - * @return mixed|null |
|
42 | + * @return boolean |
|
43 | 43 | */ |
44 | 44 | public function __isset($name) |
45 | 45 | { |
@@ -1,8 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Ds\Traits; |
3 | 3 | |
4 | -use Ds\Deque; |
|
5 | - |
|
6 | 4 | /** |
7 | 5 | * Common to structures that deal with an internal capacity. While none of the |
8 | 6 | * PHP implementations actually make use of a capacity, it's important to keep |
@@ -118,7 +118,7 @@ |
||
118 | 118 | { |
119 | 119 | $this->capacity = max( |
120 | 120 | self::MIN_CAPACITY, |
121 | - $this->capacity() * $this->getDecayFactor() |
|
121 | + $this->capacity() * $this->getDecayFactor() |
|
122 | 122 | ); |
123 | 123 | } |
124 | 124 |