Version: 3.1.0
/cc @adaamz @milo @dg
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:
|
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?
Version: 3.1.0
/cc @adaamz @milo @dg
This commit 2fce9b9 changed SubmitButton::$onClick type to:
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
This change causes PHPStan to report this error on valid code:
Is my train of thought correct? Or should user's callables be ready to accept Form instance in some cases too?