diff --git a/src/ComponentModel/Container.php b/src/ComponentModel/Container.php index e6a9f40..4a38947 100644 --- a/src/ComponentModel/Container.php +++ b/src/ComponentModel/Container.php @@ -178,12 +178,13 @@ protected function createComponent(string $name): ?IComponent /** - * Iterates over descendants components. + * Returns immediate child components. * @return iterable */ - final public function getComponents(bool $deep = false, ?string $filterType = null): iterable + final public function getComponents(): iterable { - if ($deep) { + $filterType = func_get_args()[1] ?? null; + if (func_get_args()[0] ?? null) { // back compatibility $iterator = new RecursiveComponentIterator($this->components); $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST); if ($filterType) { diff --git a/src/ComponentModel/IContainer.php b/src/ComponentModel/IContainer.php index 9ed605f..12cfb84 100644 --- a/src/ComponentModel/IContainer.php +++ b/src/ComponentModel/IContainer.php @@ -35,8 +35,8 @@ function removeComponent(IComponent $component): void; function getComponent(string $name): ?IComponent; /** - * Iterates over descendants components. - * @return iterable + * Returns immediate child components. + * @return array */ function getComponents(): iterable; }