Skip to content

Commit

Permalink
Container::getComponents() parameters are silently deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 8, 2024
1 parent 3dc759c commit bb838ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/ComponentModel/Container.php
Expand Up @@ -178,12 +178,13 @@ protected function createComponent(string $name): ?IComponent


/**
* Iterates over descendants components.
* @return iterable<int|string,IComponent>
* Returns immediate child components.
* @return array<int|string,IComponent>
*/
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) {
Expand Down
4 changes: 2 additions & 2 deletions src/ComponentModel/IContainer.php
Expand Up @@ -35,8 +35,8 @@ function removeComponent(IComponent $component): void;
function getComponent(string $name): ?IComponent;

/**
* Iterates over descendants components.
* @return iterable<int|string,IComponent>
* Returns immediate child components.
* @return array<int|string,IComponent>
*/
function getComponents(): iterable;
}

0 comments on commit bb838ad

Please sign in to comment.