-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Form] getClickedButton()
missing in FormInterface returned by builder
#35277
Comments
And when trying it the other way as explained at https://symfony.com/doc/current/form/multiple_buttons.html $form->get('saveAndAdd')->isClicked() ... I'm getting:
|
If you want to stop PHPStan complaining about it without adding it to the baseline, you can do something like this: if ($form instanceof Form) {
$button = $form->getClickedButton();
}
// or
/** @var Form $form */
$button = $form->getClickedButton(); I don't think there is anything we can do in the Form component about this. |
at least SF anticipates each form implementation may implement this: symfony/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php Lines 167 to 169 in 80cc6bd
which to me is a hint it's missing in some contract, somewhere |
@ro0NL Technically there could be other implementations of the I am closing as explained in #35277 (comment). |
Symfony version(s) affected: 4.4
phpstan reports:
According to @althaus this is because
getClickedButton()
is not included in the FormInterface returned by the builder, see phpstan/phpstan-symfony#12 (comment)The text was updated successfully, but these errors were encountered: