From 27bfb049f357a7b548fd1b5181d1a30dd32e321c Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Tue, 8 Jun 2021 18:35:42 +0200 Subject: [PATCH] Adjusting interface and implementation to use \Iterator instead of array --- Classes/MenuService/ServiceInterface.php | 2 +- Classes/MenuService/SettingsService.php | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Classes/MenuService/ServiceInterface.php b/Classes/MenuService/ServiceInterface.php index f72e77a..bb3c892 100644 --- a/Classes/MenuService/ServiceInterface.php +++ b/Classes/MenuService/ServiceInterface.php @@ -22,5 +22,5 @@ interface ServiceInterface * * @return array|\Iterator */ - public function getItems(string $forPath = null): array; + public function getItems(string $forPath = null): \Iterator; } diff --git a/Classes/MenuService/SettingsService.php b/Classes/MenuService/SettingsService.php index 5e3c814..99ca0b4 100644 --- a/Classes/MenuService/SettingsService.php +++ b/Classes/MenuService/SettingsService.php @@ -32,11 +32,7 @@ class SettingsService implements ServiceInterface */ protected array $items = array(); - /** - * @param string|null $forPath - * @return array - */ - public function getItems(string $forPath = null): array + public function getItems(string $forPath = null): \Iterator { if ($forPath) { $items = &$this->menuConfiguration[$forPath]; @@ -51,6 +47,6 @@ class SettingsService implements ServiceInterface } ); } - return $items; + return new \ArrayIterator($items); } }