Skip to content

Commit 2f180d4

Browse files
feature #61109 [Translation] Deprecate TranslatableMessage::__toString (VincentLanglet)
This PR was squashed before being merged into the 7.4 branch. Discussion ---------- [Translation] Deprecate `TranslatableMessage::__toString` | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Issues | Fix #... <!-- prefix each issue number with "Fix #"; no need to create an issue if none exists, explain below --> | License | MIT Resolve the following discussion #60935 (comment) cc `@stof` `@xabbuh` Commits ------- 916befb [Translation] Deprecate `TranslatableMessage::__toString`
2 parents 5015234 + 916befb commit 2f180d4

15 files changed

+40
-22
lines changed

UPGRADE-7.4.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ Security
5050
* Deprecate `AbstractListener::__invoke`
5151
* Deprecate `LazyFirewallContext::__invoke()`
5252

53+
Translation
54+
-----------
55+
56+
* Deprecate `TranslatableMessage::__toString`
57+
5358
Validator
5459
---------
5560

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ col-sm-2
2424

2525
{% block form_row -%}
2626
{%- set widget_attr = {} -%}
27-
{%- if help is not empty -%}
27+
{%- if help -%}
2828
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
2929
{%- endif -%}
3030
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ ((not compound or force_error|default(false)) and not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
{% set embed_label_classes = parent_label_class|split(' ')|filter(class => class in ['checkbox-inline', 'radio-inline']) %}
9595
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ embed_label_classes|join(' '))|trim}) -%}
9696
{% endif %}
97-
{%- if label is not same as(false) and label is empty -%}
97+
{%- if label is not same as(false) and not label -%}
9898
{%- if label_format is not empty -%}
9999
{%- set label = label_format|replace({
100100
'%name%': name,
@@ -129,7 +129,7 @@
129129

130130
{% block form_row -%}
131131
{%- set widget_attr = {} -%}
132-
{%- if help is not empty -%}
132+
{%- if help -%}
133133
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
134134
{%- endif -%}
135135
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ ((not compound or force_error|default(false)) and not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
@@ -199,7 +199,7 @@
199199
{# Help #}
200200

201201
{% block form_help -%}
202-
{%- if help is not empty -%}
202+
{%- if help -%}
203203
{%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' help-block')|trim}) -%}
204204
<span id="{{ id }}_help"{% with { attr: help_attr } %}{{ block('attributes') }}{% endwith %}>
205205
{%- if translation_domain is same as(false) -%}

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ col-sm-2
2525
{{ block('fieldset_form_row') }}
2626
{%- else -%}
2727
{%- set widget_attr = {} -%}
28-
{%- if help is not empty -%}
28+
{%- if help -%}
2929
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
3030
{%- endif -%}
3131
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group row' ~ ((not compound or force_error|default(false)) and not valid ? ' is-invalid'))|trim})} %}{{ block('attributes') }}{% endwith %}>
@@ -40,7 +40,7 @@ col-sm-2
4040

4141
{% block fieldset_form_row -%}
4242
{%- set widget_attr = {} -%}
43-
{%- if help is not empty -%}
43+
{%- if help -%}
4444
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
4545
{%- endif -%}
4646
<fieldset{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@
283283
{%- set element = 'fieldset' -%}
284284
{%- endif -%}
285285
{%- set widget_attr = {} -%}
286-
{%- if help is not empty -%}
286+
{%- if help -%}
287287
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
288288
{%- endif -%}
289289
<{{ element|default('div') }}{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>
@@ -310,7 +310,7 @@
310310
{# Help #}
311311

312312
{% block form_help -%}
313-
{%- if help is not empty -%}
313+
{%- if help -%}
314314
{%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' form-text text-muted')|trim}) -%}
315315
<small id="{{ id }}_help"{% with { attr: help_attr } %}{{ block('attributes') }}{% endwith %}>
316316
{{- block('form_help_content') -}}

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_horizontal_layout.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
{{ block('fieldset_form_row') }}
2929
{%- else -%}
3030
{%- set widget_attr = {} -%}
31-
{%- if help is not empty -%}
31+
{%- if help -%}
3232
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
3333
{%- endif -%}
3434
{%- set row_class = row_class|default(row_attr.class|default('mb-3')) -%}
@@ -72,7 +72,7 @@
7272

7373
{% block fieldset_form_row -%}
7474
{%- set widget_attr = {} -%}
75-
{%- if help is not empty -%}
75+
{%- if help -%}
7676
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
7777
{%- endif -%}
7878
<fieldset{% with {attr: row_attr|merge({class: row_attr.class|default('mb-3')|trim})} %}{{ block('attributes') }}{% endwith %}>

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_layout.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@
325325
{%- set element = 'fieldset' -%}
326326
{%- endif -%}
327327
{%- set widget_attr = {} -%}
328-
{%- if help is not empty -%}
328+
{%- if help -%}
329329
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
330330
{%- endif -%}
331331
{%- set row_class = row_class|default(row_attr.class|default('mb-3')|trim) -%}
@@ -367,7 +367,7 @@
367367
{#- Hack to properly display help with input group -#}
368368
{%- set help_class = ' input-group-text' -%}
369369
{%- endif -%}
370-
{%- if help is not empty -%}
370+
{%- if help -%}
371371
{%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ help_class ~ ' mb-0')|trim}) -%}
372372
{%- endif -%}
373373
{{- parent() -}}

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
{%- endblock range_widget %}
227227

228228
{%- block button_widget -%}
229-
{%- if label is empty -%}
229+
{%- if not label -%}
230230
{%- if label_format is not empty -%}
231231
{% set label = label_format|replace({
232232
'%name%': name,
@@ -301,7 +301,7 @@
301301
{%- endblock form_label -%}
302302

303303
{%- block form_label_content -%}
304-
{%- if label is empty -%}
304+
{%- if not label -%}
305305
{%- if label_format is not empty -%}
306306
{% set label = label_format|replace({
307307
'%name%': name,
@@ -331,7 +331,7 @@
331331
{# Help #}
332332

333333
{% block form_help -%}
334-
{%- if help is not empty -%}
334+
{%- if help -%}
335335
{%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' help-text')|trim}) -%}
336336
<{{ element|default('div') }} id="{{ id }}_help"{% with { attr: help_attr } %}{{ block('attributes') }}{% endwith %}>
337337
{{- block('form_help_content') -}}
@@ -367,7 +367,7 @@
367367

368368
{%- block form_row -%}
369369
{%- set widget_attr = {} -%}
370-
{%- if help is not empty -%}
370+
{%- if help -%}
371371
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
372372
{%- endif -%}
373373
<div{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>

src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{%- block form_row -%}
44
{%- set widget_attr = {} -%}
5-
{%- if help is not empty -%}
5+
{%- if help -%}
66
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
77
{%- endif -%}
88
<tr{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>

src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
{% set embed_label_classes = parent_label_class|split(' ')|filter(class => class in ['checkbox-inline', 'radio-inline']) %}
262262
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ embed_label_classes|join(' '))|trim}) -%}
263263
{% endif %}
264-
{% if label is empty %}
264+
{% if not label %}
265265
{%- if label_format is not empty -%}
266266
{% set label = label_format|replace({
267267
'%name%': name,
@@ -283,7 +283,7 @@
283283

284284
{% block form_row -%}
285285
{%- set widget_attr = {} -%}
286-
{%- if help is not empty -%}
286+
{%- if help -%}
287287
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
288288
{%- endif -%}
289289
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>

0 commit comments

Comments
 (0)