Skip to content

Commit

Permalink
coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 1, 2021
1 parent 2681dd1 commit 1c38f11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/ComponentModel/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ final public function getComponent(string $name, bool $throw = true): ?IComponen
} elseif ($throw) {
$hint = Nette\Utils\ObjectHelpers::getSuggestion(array_merge(
array_map('strval', array_keys($this->components)),
array_map('lcfirst', preg_filter('#^createComponent([A-Z0-9].*)#', '$1', get_class_methods($this)))
array_map('lcfirst', preg_filter('#^createComponent([A-Z0-9].*)#', '$1', get_class_methods($this))),
), $name);
throw new Nette\InvalidArgumentException("Component with name '$name' does not exist" . ($hint ? ", did you mean '$hint'?" : '.'));
}
Expand Down Expand Up @@ -182,9 +182,7 @@ final public function getComponents(bool $deep = false, string $filterType = nul
$iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
}
if ($filterType) {
$iterator = new \CallbackFilterIterator($iterator, function ($item) use ($filterType) {
return $item instanceof $filterType;
});
$iterator = new \CallbackFilterIterator($iterator, fn ($item) => $item instanceof $filterType);
}
return $iterator;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ComponentModel/Container.zeroname.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ Assert::same('0', $container->getComponent('0')->getName());
$container->addComponent($c1 = new Container, '1', '0');
Assert::same(
[1 => $c1, 0 => $c0],
(array) $container->getComponents()
(array) $container->getComponents(),
);

0 comments on commit 1c38f11

Please sign in to comment.