Skip to content

Commit 45902eb

Browse files
committed
Container::getControls() does not use deprecated parameters
1 parent 4f69a13 commit 45902eb

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"php": "8.2 - 8.5",
1919
"nette/component-model": "^3.2",
2020
"nette/http": "^3.3",
21-
"nette/utils": "^4.0.4"
21+
"nette/utils": "^4.0.10"
2222
},
2323
"require-dev": {
2424
"nette/application": "^3.3",

src/Forms/Container.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,15 @@ public function addComponent(
287287
/**
288288
* Iterates over all form controls.
289289
*/
290-
public function getControls(): \Iterator
290+
public function getControls(): iterable
291291
{
292-
return $this->getComponents(true, Control::class);
292+
return Nette\Utils\Iterables::repeatable(function () {
293+
foreach ($this->getComponentTree() as $component) {
294+
if ($component instanceof Control) {
295+
yield $component->getName() => $component;
296+
}
297+
}
298+
});
293299
}
294300

295301

0 commit comments

Comments
 (0)