From 87c91fb81b47461239dffa97f399fdb090aa4b1f Mon Sep 17 00:00:00 2001 From: Jules Pietri Date: Mon, 24 Jul 2023 09:08:33 +0200 Subject: [PATCH] [Form] Remove deprecations in form events --- UPGRADE-7.0.md | 2 ++ src/Symfony/Component/Form/Event/PostSetDataEvent.php | 6 +----- src/Symfony/Component/Form/Event/PostSubmitEvent.php | 7 ++----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/UPGRADE-7.0.md b/UPGRADE-7.0.md index 03e377567e01..3a674841efb3 100644 --- a/UPGRADE-7.0.md +++ b/UPGRADE-7.0.md @@ -99,6 +99,8 @@ Form `model_timezone` option in `DateType`, `DateTimeType`, and `TimeType` * Make the "widget" option of date/time form types default to "single_text" * Require explicit argument when calling `Button/Form::setParent()`, `ButtonBuilder/FormConfigBuilder::setDataMapper()`, `TransformationFailedException::setInvalidMessage()` + * `PostSetDataEvent::setData()` throws an exception, use `PreSetDataEvent::setData()` instead + * `PostSubmitEvent::setData()` throws an exception, use `PreSubmitDataEvent::setData()` or `SubmitDataEvent::setData()` instead FrameworkBundle --------------- diff --git a/src/Symfony/Component/Form/Event/PostSetDataEvent.php b/src/Symfony/Component/Form/Event/PostSetDataEvent.php index b42012d68276..74aeb78d509a 100644 --- a/src/Symfony/Component/Form/Event/PostSetDataEvent.php +++ b/src/Symfony/Component/Form/Event/PostSetDataEvent.php @@ -22,12 +22,8 @@ */ final class PostSetDataEvent extends FormEvent { - /** - * @deprecated since Symfony 6.4, it will throw an exception in 7.0. - */ public function setData(mixed $data): void { - trigger_deprecation('symfony/form', '6.4', 'Calling "%s()" will throw an exception as of 7.0, listen to "form.pre_set_data" instead.', __METHOD__); - // throw new BadMethodCallException('Form data cannot be changed during "form.post_set_data", you should use "form.pre_set_data" instead.'); + throw new BadMethodCallException('Form data cannot be changed during "form.post_set_data", you should use "form.pre_set_data" instead.'); } } diff --git a/src/Symfony/Component/Form/Event/PostSubmitEvent.php b/src/Symfony/Component/Form/Event/PostSubmitEvent.php index b7fb10176a9d..104ea2d0ecff 100644 --- a/src/Symfony/Component/Form/Event/PostSubmitEvent.php +++ b/src/Symfony/Component/Form/Event/PostSubmitEvent.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Form\Event; +use Symfony\Component\Form\Exception\BadMethodCallException; use Symfony\Component\Form\FormEvent; /** @@ -21,12 +22,8 @@ */ final class PostSubmitEvent extends FormEvent { - /** - * @deprecated since Symfony 6.4, it will throw an exception in 7.0. - */ public function setData(mixed $data): void { - trigger_deprecation('symfony/form', '6.4', 'Calling "%s()" will throw an exception as of 7.0, listen to "form.pre_submit" or "form.submit" instead.', __METHOD__); - // throw new BadMethodCallException('Form data cannot be changed during "form.post_submit", you should use "form.pre_submit" or "form.submit" instead.'); + throw new BadMethodCallException('Form data cannot be changed during "form.post_submit", you should use "form.pre_submit" or "form.submit" instead.'); } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy