Skip to content

Commit

Permalink
Fix PHPStan issue with nette/component-model 3.1.0
Browse files Browse the repository at this point in the history
nette/component-model 3.1.0 made the type annotations more precise,
correctly declaring that `null` will not be returned when `$throw` argument is `true` (default):
nette/component-model@fbab7bc

As a result PHPStan started to complain:

    Expression on left side of ?? is not nullable.

(cherry picked from commit 7445d0d, 2afcd08)
  • Loading branch information
jtojnar committed Mar 20, 2024
1 parent 7f6bad4 commit f3a0afb
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 @@ -11,6 +11,7 @@
use Nette\Forms\Controls\BaseControl;
use Nette\Forms\Controls\SubmitButton;
use Nette\Forms\Form;
use Nette\InvalidStateException;
use Nette\Utils\ArrayHash;
use Nette\Utils\Arrays;
use Traversable;
Expand Down Expand Up @@ -412,10 +413,11 @@ protected function fillContainer(Container $container): void

/**
* @return string[]
* @throws InvalidStateException when not attached.
*/
protected function getHtmlName(): array
{
return explode('-', $this->lookupPath(Form::class) ?? '');
return explode('-', $this->lookupPath(Form::class));
}

protected function createContainer(): Container
Expand Down

0 comments on commit f3a0afb

Please sign in to comment.