Skip to content

Commit

Permalink
Collection return type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
lennyrouanet committed May 4, 2022
1 parent 53bb8c1 commit 662ae43
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions component/Abstract/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function __construct(array $items = [])
$this->items = $items;
}

protected function addItem(mixed $item)
protected function addItem(mixed $item): self
{
if (array_search($item, $this->items) == false) {
$this->items[] = $item;
Expand All @@ -21,7 +21,7 @@ protected function addItem(mixed $item)
return $this;
}

protected function removeItem(mixed $item)
protected function removeItem(mixed $item): self
{
if (($key = array_search($item, $this->items)) !== false) {
unset($this->items[ $key ]);
Expand All @@ -30,7 +30,7 @@ protected function removeItem(mixed $item)
return $this;
}

public function itemsIterator()
public function itemsIterator(): \Generator
{
foreach ($this->items as $item) {
yield $item;
Expand Down

0 comments on commit 662ae43

Please sign in to comment.