diff --git a/UPGRADE-7.4.md b/UPGRADE-7.4.md index e496e069e72b..0ce57379aede 100644 --- a/UPGRADE-7.4.md +++ b/UPGRADE-7.4.md @@ -50,6 +50,11 @@ Security * Deprecate `AbstractListener::__invoke` * Deprecate `LazyFirewallContext::__invoke()` +Translation +----------- + + * Deprecate `TranslatableMessage::__toString` + Validator --------- diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig index 49cd804398b5..fc7289c8c393 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig @@ -24,7 +24,7 @@ col-sm-2 {% block form_row -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig index f4e313b4756c..bfb9d89aaeec 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig @@ -94,7 +94,7 @@ {% set embed_label_classes = parent_label_class|split(' ')|filter(class => class in ['checkbox-inline', 'radio-inline']) %} {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ embed_label_classes|join(' '))|trim}) -%} {% endif %} - {%- if label is not same as(false) and label is empty -%} + {%- if label is not same as(false) and not label -%} {%- if label_format is not empty -%} {%- set label = label_format|replace({ '%name%': name, @@ -129,7 +129,7 @@ {% block form_row -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} @@ -199,7 +199,7 @@ {# Help #} {% block form_help -%} - {%- if help is not empty -%} + {%- if help -%} {%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' help-block')|trim}) -%} {%- if translation_domain is same as(false) -%} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig index 990b324cb0d1..516d79938d6a 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig @@ -25,7 +25,7 @@ col-sm-2 {{ block('fieldset_form_row') }} {%- else -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} @@ -40,7 +40,7 @@ col-sm-2 {% block fieldset_form_row -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig index 458cc6847ed8..9681d4f81c0f 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig @@ -283,7 +283,7 @@ {%- set element = 'fieldset' -%} {%- endif -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} <{{ element|default('div') }}{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}> @@ -310,7 +310,7 @@ {# Help #} {% block form_help -%} - {%- if help is not empty -%} + {%- if help -%} {%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' form-text text-muted')|trim}) -%} {{- block('form_help_content') -}} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_horizontal_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_horizontal_layout.html.twig index 3c24166d48ad..1d08cc5eb0e8 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_horizontal_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_horizontal_layout.html.twig @@ -28,7 +28,7 @@ {{ block('fieldset_form_row') }} {%- else -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} {%- set row_class = row_class|default(row_attr.class|default('mb-3')) -%} @@ -72,7 +72,7 @@ {% block fieldset_form_row -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_layout.html.twig index 17b28fc9ab8d..d79c0af33577 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_layout.html.twig @@ -325,7 +325,7 @@ {%- set element = 'fieldset' -%} {%- endif -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} {%- set row_class = row_class|default(row_attr.class|default('mb-3')|trim) -%} @@ -367,7 +367,7 @@ {#- Hack to properly display help with input group -#} {%- set help_class = ' input-group-text' -%} {%- endif -%} - {%- if help is not empty -%} + {%- if help -%} {%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ help_class ~ ' mb-0')|trim}) -%} {%- endif -%} {{- parent() -}} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index 537849faebaa..cbc18f669250 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -226,7 +226,7 @@ {%- endblock range_widget %} {%- block button_widget -%} - {%- if label is empty -%} + {%- if not label -%} {%- if label_format is not empty -%} {% set label = label_format|replace({ '%name%': name, @@ -301,7 +301,7 @@ {%- endblock form_label -%} {%- block form_label_content -%} - {%- if label is empty -%} + {%- if not label -%} {%- if label_format is not empty -%} {% set label = label_format|replace({ '%name%': name, @@ -331,7 +331,7 @@ {# Help #} {% block form_help -%} - {%- if help is not empty -%} + {%- if help -%} {%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' help-text')|trim}) -%} <{{ element|default('div') }} id="{{ id }}_help"{% with { attr: help_attr } %}{{ block('attributes') }}{% endwith %}> {{- block('form_help_content') -}} @@ -367,7 +367,7 @@ {%- block form_row -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig index 00a51ab04bc2..f4f32f1b3ee1 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig @@ -2,7 +2,7 @@ {%- block form_row -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig index 23e463e6822f..d6f45e0e2183 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig @@ -261,7 +261,7 @@ {% set embed_label_classes = parent_label_class|split(' ')|filter(class => class in ['checkbox-inline', 'radio-inline']) %} {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ embed_label_classes|join(' '))|trim}) -%} {% endif %} - {% if label is empty %} + {% if not label %} {%- if label_format is not empty -%} {% set label = label_format|replace({ '%name%': name, @@ -283,7 +283,7 @@ {% block form_row -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/tailwind_2_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/tailwind_2_layout.html.twig index 7f31e70b796c..0a7038cb09f7 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/tailwind_2_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/tailwind_2_layout.html.twig @@ -45,7 +45,7 @@ {%- block checkbox_row -%} {%- set row_attr = row_attr|merge({ class: row_attr.class|default(row_class|default('mb-6')) }) -%} {%- set widget_attr = {} -%} - {%- if help is not empty -%} + {%- if help -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig index 2bd1b2cc6d50..c5710377bdab 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig +++ b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig @@ -5,14 +5,14 @@ {%- endblock _text_id_widget %} {% block _names_entry_label -%} - {% if label is empty %} + {% if not label %} {%- set label = name|humanize -%} {% endif -%} {%- endblock _names_entry_label %} {% block _name_c_entry_label -%} - {% if label is empty %} + {% if not label %} {%- set label = name|humanize -%} {% endif -%} diff --git a/src/Symfony/Component/Translation/CHANGELOG.md b/src/Symfony/Component/Translation/CHANGELOG.md index 365c5cf1cdc7..1670a537b09b 100644 --- a/src/Symfony/Component/Translation/CHANGELOG.md +++ b/src/Symfony/Component/Translation/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +7.4 +--- + + * Deprecate `TranslatableMessage::__toString` + 7.3 --- diff --git a/src/Symfony/Component/Translation/Tests/TranslatableTest.php b/src/Symfony/Component/Translation/Tests/TranslatableTest.php index ce08c8ae1a8b..2bfc02539c07 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatableTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatableTest.php @@ -42,6 +42,9 @@ public function testFlattenedTrans($expected, $messages, $translatable) $this->assertSame($expected, $translatable->trans($translator, 'fr')); } + /** + * @group legacy + */ public function testToString() { $this->assertSame('Symfony is great!', (string) new TranslatableMessage('Symfony is great!')); diff --git a/src/Symfony/Component/Translation/TranslatableMessage.php b/src/Symfony/Component/Translation/TranslatableMessage.php index 3c4986a67a7d..7463803793dc 100644 --- a/src/Symfony/Component/Translation/TranslatableMessage.php +++ b/src/Symfony/Component/Translation/TranslatableMessage.php @@ -26,8 +26,13 @@ public function __construct( ) { } + /** + * @deprecated since Symfony 7.4 + */ public function __toString(): string { + trigger_deprecation('symfony/translation', '7.4', 'Method "%s()" is deprecated.', __METHOD__); + return $this->getMessage(); } 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