Skip to content

Commit 45cf2a8

Browse files
committed
Fix PHPStan issue after nette/forms added more types
nette/forms@0cd5069 added more types but that is overly broad for our usage pattern. We need to cast it to proper value until the return type is clarified upstream. Also use `$this->getForm()` instead of `$this->form` since the former is already checked not to be `null` by `$this->isFormSubmitted()`.
1 parent 73f42f5 commit 45cf2a8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Multiplier.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ protected function isFormSubmitted(): bool
390390
protected function loadHttpData(): void
391391
{
392392
if ($this->isFormSubmitted()) {
393-
$httpData = Arrays::get($this->form->getHttpData(), $this->getHtmlName(), []);
393+
/** @var array<mixed> The other types from the union can only be returned when the htmlName argument is passed. https://github.com/nette/forms/pull/333 */
394+
$httpData = $this->getForm()->getHttpData();
395+
$httpData = Arrays::get($httpData, $this->getHtmlName(), []);
394396
$this->resolver = new ComponentResolver($httpData ?? [], $this->maxCopies, $this->minCopies);
395397
}
396398
}

0 commit comments

Comments
 (0)