@@ -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 | } |
@@ -19,6 +19,7 @@ discard block |
||
19 | 19 | * @param int $capacity The number of values for which capacity should be |
20 | 20 | * allocated. Capacity will stay the same if this value |
21 | 21 | * is less than or equal to the current capacity. |
22 | + * @return void |
|
22 | 23 | */ |
23 | 24 | function allocate(int $capacity); |
24 | 25 | |
@@ -27,6 +28,7 @@ discard block |
||
27 | 28 | * return value as the new value. |
28 | 29 | * |
29 | 30 | * @param callable $callback Accepts the value, returns the new value. |
31 | + * @return void |
|
30 | 32 | */ |
31 | 33 | function apply(callable $callback); |
32 | 34 | |
@@ -98,6 +100,7 @@ discard block |
||
98 | 100 | * @param mixed ...$values |
99 | 101 | * |
100 | 102 | * @throws \OutOfRangeException if the index is not in the range [0, n] |
103 | + * @return void |
|
101 | 104 | */ |
102 | 105 | function insert(int $index, ...$values); |
103 | 106 | |
@@ -152,6 +155,7 @@ discard block |
||
152 | 155 | * Adds zero or more values to the end of the sequence. |
153 | 156 | * |
154 | 157 | * @param mixed ...$values |
158 | + * @return void |
|
155 | 159 | */ |
156 | 160 | function push(...$values); |
157 | 161 | |
@@ -181,6 +185,7 @@ discard block |
||
181 | 185 | |
182 | 186 | /** |
183 | 187 | * Reverses the sequence in-place. |
188 | + * @return void |
|
184 | 189 | */ |
185 | 190 | function reverse(); |
186 | 191 | |
@@ -197,6 +202,7 @@ discard block |
||
197 | 202 | * positive, or 'pop' and 'unshift' if negative. |
198 | 203 | * |
199 | 204 | * @param int $rotations The number of rotations (can be negative). |
205 | + * @return void |
|
200 | 206 | */ |
201 | 207 | function rotate(int $rotations); |
202 | 208 | |
@@ -207,6 +213,7 @@ discard block |
||
207 | 213 | * @param mixed $value |
208 | 214 | * |
209 | 215 | * @throws \OutOfRangeException if the index is not in the range [0, size-1] |
216 | + * @return void |
|
210 | 217 | */ |
211 | 218 | function set(int $index, $value); |
212 | 219 | |
@@ -247,6 +254,7 @@ discard block |
||
247 | 254 | * |
248 | 255 | * @param callable|null $comparator Accepts two values to be compared. |
249 | 256 | * Should return the result of a <=> b. |
257 | + * @return void |
|
250 | 258 | */ |
251 | 259 | function sort(callable $comparator = null); |
252 | 260 | |
@@ -272,6 +280,7 @@ discard block |
||
272 | 280 | * Adds zero or more values to the front of the sequence. |
273 | 281 | * |
274 | 282 | * @param mixed ...$values |
283 | + * @return void |
|
275 | 284 | */ |
276 | 285 | function unshift(...$values); |
277 | 286 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * Creates a new instance. |
29 | 29 | * |
30 | - * @param array|\Traversable|null $values |
|
30 | + * @param Map $values |
|
31 | 31 | */ |
32 | 32 | public function __construct($values = null) |
33 | 33 | { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * Returns the result of associating all keys of a given traversable object |
113 | 113 | * or array with their corresponding values, as well as those of this map. |
114 | 114 | * |
115 | - * @param array|\Traversable $values |
|
115 | + * @param Map $values |
|
116 | 116 | * |
117 | 117 | * @return Map |
118 | 118 | */ |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Ds; |
3 | 3 | |
4 | -use Error; |
|
5 | 4 | use OutOfBoundsException; |
6 | 5 | use OutOfRangeException; |
7 | 6 | use Traversable; |
@@ -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 |