Skip to content

Commit a7a4770

Browse files
committed
Fixed the documentation.
This is needed in preparation for the PhpStorm stub (php-ds/ext-ds#128).
1 parent 72301e8 commit a7a4770

File tree

10 files changed

+26
-16
lines changed

10 files changed

+26
-16
lines changed

src/Hashable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function hash();
2626
* Determines if two objects should be considered equal. Both objects will
2727
* be instances of the same class but may not be the same instance.
2828
*
29-
* @param $obj An instance of the same class to compare to.
29+
* @param $obj self An instance of the same class to compare to.
3030
*
3131
* @return bool
3232
*/

src/Map.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ public function reduce(callable $callback, $initial = null)
393393
/**
394394
* Completely removes a pair from the internal array by position. It is
395395
* important to remove it from the array and not just use 'unset'.
396+
*
397+
* @param int $position
398+
*
399+
* @return mixed
396400
*/
397401
private function delete(int $position)
398402
{
@@ -434,9 +438,7 @@ public function remove($key, $default = null)
434438
}
435439

436440
/**
437-
* Returns a reversed copy of the map.
438-
*
439-
* @return Map
441+
* Sorts the map into the reversed order.
440442
*/
441443
public function reverse()
442444
{

src/Pair.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ public function jsonSerialize()
8888

8989
/**
9090
* Returns a string representation of the pair.
91+
*
92+
* @return string a string representation of the pair.
9193
*/
92-
public function __toString()
94+
public function __toString(): string
9395
{
9496
return 'object(' . get_class($this) . ')';
9597
}

src/PriorityQueue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function clear()
5050
/**
5151
* @inheritDoc
5252
*/
53-
public function copy(): \Ds\Collection
53+
public function copy(): Collection
5454
{
5555
$copy = new PriorityQueue();
5656

src/Queue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function clear()
6565
/**
6666
* @inheritDoc
6767
*/
68-
public function copy(): \Ds\Collection
68+
public function copy(): Collection
6969
{
7070
return new self($this->deque);
7171
}
@@ -81,7 +81,7 @@ public function count(): int
8181
/**
8282
* Returns the value at the front of the queue without removing it.
8383
*
84-
* @return
84+
* @return mixed
8585
*/
8686
public function peek()
8787
{

src/Set.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function contains(...$values): bool
101101
/**
102102
* @inheritDoc
103103
*/
104-
public function copy(): \Ds\Collection
104+
public function copy(): Collection
105105
{
106106
return new self($this);
107107
}

src/Traits/Capacity.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function allocate(int $capacity)
3737
}
3838

3939
/**
40-
* @return the structures growth factor.
40+
* @return float the structures growth factor.
4141
*/
4242
protected function getGrowthFactor(): float
4343
{
@@ -92,15 +92,15 @@ protected function decreaseCapacity()
9292
}
9393

9494
/**
95-
* @return whether capacity should be increased.
95+
* @return bool whether capacity should be increased.
9696
*/
9797
protected function shouldDecreaseCapacity(): bool
9898
{
9999
return count($this) <= $this->capacity * $this->getTruncateThreshold();
100100
}
101101

102102
/**
103-
* @return whether capacity should be increased.
103+
* @return bool whether capacity should be increased.
104104
*/
105105
protected function shouldIncreaseCapacity(): bool
106106
{

src/Traits/GenericCollection.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function isEmpty(): bool
2525
* Returns a representation that can be natively converted to JSON, which is
2626
* called when invoking json_encode.
2727
*
28-
* @return mixed
28+
* @return mixed the data to be JSON encoded.
2929
*
3030
* @see JsonSerializable
3131
*/
@@ -60,16 +60,18 @@ abstract public function toArray(): array;
6060
*
6161
* @return array
6262
*/
63-
public function __debugInfo()
63+
public function __debugInfo(): array
6464
{
6565
return $this->toArray();
6666
}
6767

6868
/**
6969
* Returns a string representation of the collection, which is invoked when
7070
* the collection is converted to a string.
71+
*
72+
* @return string
7173
*/
72-
public function __toString()
74+
public function __toString(): string
7375
{
7476
return 'object(' . get_class($this) . ')';
7577
}

src/Traits/GenericSequence.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ public function reversed(): Sequence
236236
/**
237237
* Converts negative or large rotations into the minimum positive number
238238
* of rotations required to rotate the sequence by a given $r.
239+
*
240+
* @param int $r
241+
*
242+
* @return int
239243
*/
240244
private function normalizeRotations(int $r)
241245
{

src/Vector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function getGrowthFactor(): float
2323
}
2424

2525
/**
26-
* @return whether capacity should be increased.
26+
* @return bool whether capacity should be increased.
2727
*/
2828
protected function shouldIncreaseCapacity(): bool
2929
{

0 commit comments

Comments
 (0)