Skip to content

Commit c871bb6

Browse files
committed
ensures that getType() returns ReflectionNamedType
1 parent 33e0830 commit c871bb6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Forms/Container.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ public function validate(array $controls = null): void
172172
}
173173
foreach ($this->onValidate as $handler) {
174174
$params = Nette\Utils\Callback::toReflection($handler)->getParameters();
175-
$values = isset($params[1]) ? $this->getValues($params[1]->getType() ? $params[1]->getType()->getName() : null) : null;
175+
$values = isset($params[1])
176+
? $this->getValues($params[1]->getType() instanceof \ReflectionNamedType ? $params[1]->getType()->getName() : null)
177+
: null;
176178
$handler($this, $values);
177179
}
178180
}

src/Forms/Form.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,9 @@ private function invokeHandlers(iterable $handlers, $button = null): void
427427
{
428428
foreach ($handlers as $handler) {
429429
$params = Nette\Utils\Callback::toReflection($handler)->getParameters();
430-
$values = isset($params[1]) ? $this->getValues($params[1]->getType() ? $params[1]->getType()->getName() : null) : null;
430+
$values = isset($params[1])
431+
? $this->getValues($params[1]->getType() instanceof \ReflectionNamedType ? $params[1]->getType()->getName() : null)
432+
: null;
431433
$handler($button ?: $this, $values);
432434
if (!$this->isValid()) {
433435
return;

0 commit comments

Comments
 (0)