Skip to content

Commit

Permalink
Fix PHPStan issue after nette/forms added more types
Browse files Browse the repository at this point in the history
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()`.
  • Loading branch information
jtojnar committed May 14, 2024
1 parent 73f42f5 commit 45cf2a8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Multiplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ protected function isFormSubmitted(): bool
protected function loadHttpData(): void
{
if ($this->isFormSubmitted()) {
$httpData = Arrays::get($this->form->getHttpData(), $this->getHtmlName(), []);
/** @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 */

Check failure on line 393 in src/Multiplier.php

View workflow job for this annotation

GitHub Actions / Codesniffer / Codesniffer (8.1)

Invalid inline documentation comment format "@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", expected "@var type $variableName Optional description".

Check failure on line 393 in src/Multiplier.php

View workflow job for this annotation

GitHub Actions / Codesniffer / Codesniffer (8.1)

Invalid inline documentation comment format "@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", expected "@var type $variableName Optional description".

Check failure on line 393 in src/Multiplier.php

View workflow job for this annotation

GitHub Actions / Codesniffer / Codesniffer (8.1)

Invalid inline documentation comment format "@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", expected "@var type $variableName Optional description".
$httpData = $this->getForm()->getHttpData();
$httpData = Arrays::get($httpData, $this->getHtmlName(), []);
$this->resolver = new ComponentResolver($httpData ?? [], $this->maxCopies, $this->minCopies);
}
}
Expand Down

0 comments on commit 45cf2a8

Please sign in to comment.