From 662ae43493ae0cb985d1c1599258ed6649b3ad9b Mon Sep 17 00:00:00 2001 From: Lenny ROUANET Date: Wed, 4 May 2022 17:06:50 +0200 Subject: [PATCH] Collection return type hint --- component/Abstract/Collection.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/component/Abstract/Collection.php b/component/Abstract/Collection.php index 2583c1c..8b4cca7 100644 --- a/component/Abstract/Collection.php +++ b/component/Abstract/Collection.php @@ -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; @@ -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 ]); @@ -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;