Skip to content

Commit

Permalink
Fixed the documentation.
Browse files Browse the repository at this point in the history
This is needed in preparation for the PhpStorm stub (php-ds/php-ds#128).
  • Loading branch information
hopeseekr committed Mar 30, 2019
1 parent 72301e8 commit 19705ed
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Hashable.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function hash();
* Determines if two objects should be considered equal. Both objects will
* be instances of the same class but may not be the same instance.
*
* @param $obj An instance of the same class to compare to.
* @param $obj self An instance of the same class to compare to.
*
* @return bool
*/
Expand Down
8 changes: 5 additions & 3 deletions src/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ public function reduce(callable $callback, $initial = null)
/**
* Completely removes a pair from the internal array by position. It is
* important to remove it from the array and not just use 'unset'.
*
* @param int $position
*
* @return mixed
*/
private function delete(int $position)
{
Expand Down Expand Up @@ -434,9 +438,7 @@ public function remove($key, $default = null)
}

/**
* Returns a reversed copy of the map.
*
* @return Map
* Sorts the map into the reversed order.
*/
public function reverse()
{
Expand Down
4 changes: 3 additions & 1 deletion src/Pair.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ public function jsonSerialize()

/**
* Returns a string representation of the pair.
*
* @return string a string representation of the pair.
*/
public function __toString()
public function __toString(): string
{
return 'object(' . get_class($this) . ')';
}
Expand Down
2 changes: 1 addition & 1 deletion src/PriorityQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function clear()
/**
* @inheritDoc
*/
public function copy(): \Ds\Collection
public function copy(): Collection
{
$copy = new PriorityQueue();

Expand Down
4 changes: 2 additions & 2 deletions src/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function clear()
/**
* @inheritDoc
*/
public function copy(): \Ds\Collection
public function copy(): Collection
{
return new self($this->deque);
}
Expand All @@ -81,7 +81,7 @@ public function count(): int
/**
* Returns the value at the front of the queue without removing it.
*
* @return
* @return mixed
*/
public function peek()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function contains(...$values): bool
/**
* @inheritDoc
*/
public function copy(): \Ds\Collection
public function copy(): Collection
{
return new self($this);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Traits/Capacity.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function allocate(int $capacity)
}

/**
* @return the structures growth factor.
* @return float the structures growth factor.
*/
protected function getGrowthFactor(): float
{
Expand Down Expand Up @@ -92,15 +92,15 @@ protected function decreaseCapacity()
}

/**
* @return whether capacity should be increased.
* @return bool whether capacity should be increased.
*/
protected function shouldDecreaseCapacity(): bool
{
return count($this) <= $this->capacity * $this->getTruncateThreshold();
}

/**
* @return whether capacity should be increased.
* @return bool whether capacity should be increased.
*/
protected function shouldIncreaseCapacity(): bool
{
Expand Down
8 changes: 5 additions & 3 deletions src/Traits/GenericCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function isEmpty(): bool
* Returns a representation that can be natively converted to JSON, which is
* called when invoking json_encode.
*
* @return mixed
* @return mixed the data to be JSON encoded.
*
* @see JsonSerializable
*/
Expand Down Expand Up @@ -60,16 +60,18 @@ abstract public function toArray(): array;
*
* @return array
*/
public function __debugInfo()
public function __debugInfo(): array
{
return $this->toArray();
}

/**
* Returns a string representation of the collection, which is invoked when
* the collection is converted to a string.
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return 'object(' . get_class($this) . ')';
}
Expand Down
4 changes: 4 additions & 0 deletions src/Traits/GenericSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ public function reversed(): Sequence
/**
* Converts negative or large rotations into the minimum positive number
* of rotations required to rotate the sequence by a given $r.
*
* @param int $r
*
* @return int
*/
private function normalizeRotations(int $r)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Vector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function getGrowthFactor(): float
}

/**
* @return whether capacity should be increased.
* @return bool whether capacity should be increased.
*/
protected function shouldIncreaseCapacity(): bool
{
Expand Down

0 comments on commit 19705ed

Please sign in to comment.