-
-
Notifications
You must be signed in to change notification settings - Fork 151
Closed
Description
Version: 3.1.0
This commit 2fce9b9 changed SubmitButton::$onClick type to:
/** @var callable[]&((callable(Nette\Forms\Form|SubmitButton, array|object): void)|(callable(array|object): void))[]
Which means "pass a callable that's ready to accept either Nette\Forms\Form or SubmitButton". But users usually pass in a callable that only accepts "SubmitButton" and it looks like SubmitButton will only ever be passed as an argument:
forms/src/Forms/Controls/SubmitButton.php
Line 96 in 2fce9b9
| Nette\Utils\Arrays::invoke($this->onClick, $this); |
This change causes PHPStan to report this error on valid code:
Array (array<callable(Nette\Forms\Controls\SubmitButton|Nette\Forms\Form, array|object): void>) does not accept Closure(Nette\Forms\Controls\SubmitButton, array): void.
Is my train of thought correct? Or should user's callables be ready to accept Form instance in some cases too?
Metadata
Metadata
Assignees
Labels
No labels