Skip to content

Commit 4a926f2

Browse files
committed
Merge remote-tracking branch 'upstream/2.7' into feature/13919-translations-cache-warmer
Conflicts: src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
2 parents d1015db + 007386c commit 4a926f2

File tree

99 files changed

+3245
-368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+3245
-368
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
phpunit.xml
1+
.php_cs.cache
2+
autoload.php
23
composer.lock
34
composer.phar
4-
autoload.php
55
package*.tar
66
packages.json
7+
phpunit.xml
78
/vendor/

.php_cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
return Symfony\CS\Config\Config::create()
4+
->setUsingLinter(false)
5+
->setUsingCache(true)
6+
->finder(
7+
Symfony\CS\Finder\DefaultFinder::create()
8+
->in(__DIR__)
9+
->exclude(array(
10+
// directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code
11+
'src/Symfony/Component/DependencyInjection/Tests/Fixtures',
12+
'src/Symfony/Component/Routing/Tests/Fixtures/dumper',
13+
// fixture templates
14+
'src/Symfony/Component/Templating/Tests/Fixtures/templates',
15+
// resource templates
16+
'src/Symfony/Bundle/FrameworkBundle/Resources/views/Form',
17+
))
18+
// file content autogenerated by `var_export`
19+
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
20+
// autogenerated xmls
21+
->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_1.xml')
22+
->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_2.xml')
23+
// yml
24+
->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml')
25+
// test template
26+
->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php')
27+
)
28+
;

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ env:
2525
- SYMFONY_DEPRECATIONS_HELPER=weak
2626

2727
before_install:
28+
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then git fetch origin "refs/pull/$TRAVIS_PULL_REQUEST/merge"; else git fetch origin "$TRAVIS_BRANCH"; fi;
29+
- if [[ "$TRAVIS_COMMIT" != `git rev-parse FETCH_HEAD` ]]; then echo "Pull request or branch commit hash has changed, aborting!"; exit 1; fi;
2830
- travis_retry sudo apt-get install parallel
2931
- composer self-update
3032
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then phpenv config-rm xdebug.ini; fi;

src/Symfony/Bridge/Twig/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* added LogoutUrlExtension (provides `logout_url` and `logout_path`)
88
* added an HttpFoundation extension (provides the `absolute_url` and the `relative_path` functions)
99
* added AssetExtension (provides the `asset` and `asset_version` functions)
10+
* Added possibility to extract translation messages from a file or files besides extracting from a directory
1011

1112
2.5.0
1213
-----

src/Symfony/Bridge/Twig/Extension/TranslationExtension.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,11 @@ public function getTranslationNodeVisitor()
9090

9191
public function trans($message, array $arguments = array(), $domain = null, $locale = null)
9292
{
93-
if (null === $domain) {
94-
$domain = 'messages';
95-
}
96-
9793
return $this->translator->trans($message, $arguments, $domain, $locale);
9894
}
9995

10096
public function transchoice($message, $count, array $arguments = array(), $domain = null, $locale = null)
10197
{
102-
if (null === $domain) {
103-
$domain = 'messages';
104-
}
105-
10698
return $this->translator->transChoice($message, $count, array_merge(array('%count%' => $count), $arguments), $domain, $locale);
10799
}
108100

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

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{% block form_widget_simple -%}
66
{% if type is not defined or 'file' != type %}
7-
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) %}
7+
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%}
88
{% endif %}
99
{{- parent() -}}
1010
{%- endblock form_widget_simple %}
@@ -42,48 +42,48 @@
4242
{% block datetime_widget -%}
4343
{% if widget == 'single_text' %}
4444
{{- block('form_widget_simple') -}}
45-
{% else %}
46-
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) %}
45+
{% else -%}
46+
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%}
4747
<div {{ block('widget_container_attributes') }}>
48-
{{ form_errors(form.date) }}
49-
{{ form_errors(form.time) }}
50-
{{ form_widget(form.date, { datetime: true } ) }}&nbsp;
51-
{{ form_widget(form.time, { datetime: true } ) }}
48+
{{- form_errors(form.date) -}}
49+
{{- form_errors(form.time) -}}
50+
{{- form_widget(form.date, { datetime: true } ) -}}
51+
{{- form_widget(form.time, { datetime: true } ) -}}
5252
</div>
53-
{% endif %}
53+
{%- endif %}
5454
{%- endblock datetime_widget %}
5555

5656
{% block date_widget -%}
5757
{% if widget == 'single_text' %}
5858
{{- block('form_widget_simple') -}}
59-
{% else %}
60-
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) %}
61-
{% if datetime is not defined or not datetime %}
59+
{% else -%}
60+
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%}
61+
{% if datetime is not defined or not datetime -%}
6262
<div {{ block('widget_container_attributes') -}}>
63-
{% endif %}
64-
{{ date_pattern|replace({
63+
{%- endif %}
64+
{{- date_pattern|replace({
6565
'{{ year }}': form_widget(form.year),
6666
'{{ month }}': form_widget(form.month),
6767
'{{ day }}': form_widget(form.day),
68-
})|raw }}
69-
{% if datetime is not defined or not datetime %}
68+
})|raw -}}
69+
{% if datetime is not defined or not datetime -%}
7070
</div>
71-
{% endif %}
71+
{%- endif -%}
7272
{% endif %}
7373
{%- endblock date_widget %}
7474

7575
{% block time_widget -%}
7676
{% if widget == 'single_text' %}
7777
{{- block('form_widget_simple') -}}
78-
{% else %}
79-
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) %}
80-
{% if datetime is not defined or false == datetime %}
78+
{% else -%}
79+
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%}
80+
{% if datetime is not defined or false == datetime -%}
8181
<div {{ block('widget_container_attributes') -}}>
82-
{% endif %}
83-
{{ form_widget(form.hour) }}:{{ form_widget(form.minute) }}{% if with_seconds %}:{{ form_widget(form.second) }}{% endif %}
84-
{% if datetime is not defined or false == datetime %}
82+
{%- endif -%}
83+
{{- form_widget(form.hour) }}:{{ form_widget(form.minute) }}{% if with_seconds %}:{{ form_widget(form.second) }}{% endif %}
84+
{% if datetime is not defined or false == datetime -%}
8585
</div>
86-
{% endif %}
86+
{%- endif -%}
8787
{% endif %}
8888
{%- endblock time_widget %}
8989

@@ -93,57 +93,57 @@
9393
{%- endblock %}
9494

9595
{% block choice_widget_expanded -%}
96-
{% if '-inline' in label_attr.class|default('') %}
96+
{% if '-inline' in label_attr.class|default('') -%}
9797
<div class="control-group">
98-
{% for child in form %}
99-
{{ form_widget(child, {
98+
{%- for child in form %}
99+
{{- form_widget(child, {
100100
parent_label_class: label_attr.class|default(''),
101-
}) }}
102-
{% endfor %}
101+
}) -}}
102+
{% endfor -%}
103103
</div>
104-
{% else %}
104+
{%- else -%}
105105
<div {{ block('widget_container_attributes') }}>
106-
{% for child in form %}
107-
{{ form_widget(child, {
106+
{%- for child in form %}
107+
{{- form_widget(child, {
108108
parent_label_class: label_attr.class|default(''),
109-
}) }}
110-
{% endfor %}
109+
}) -}}
110+
{% endfor -%}
111111
</div>
112-
{% endif %}
112+
{%- endif %}
113113
{%- endblock choice_widget_expanded %}
114114

115115
{% block checkbox_widget -%}
116-
{% set parent_label_class = parent_label_class|default('') %}
116+
{% set parent_label_class = parent_label_class|default('') -%}
117117
{% if 'checkbox-inline' in parent_label_class %}
118-
{{ form_label(form, null, { widget: parent() }) }}
119-
{% else %}
118+
{{- form_label(form, null, { widget: parent() }) -}}
119+
{% else -%}
120120
<div class="checkbox">
121-
{{ form_label(form, null, { widget: parent() }) }}
121+
{{- form_label(form, null, { widget: parent() }) -}}
122122
</div>
123-
{% endif %}
123+
{%- endif %}
124124
{%- endblock checkbox_widget %}
125125

126126
{% block radio_widget -%}
127-
{% set parent_label_class = parent_label_class|default('') %}
127+
{%- set parent_label_class = parent_label_class|default('') -%}
128128
{% if 'radio-inline' in parent_label_class %}
129-
{{ form_label(form, null, { widget: parent() }) }}
130-
{% else %}
129+
{{- form_label(form, null, { widget: parent() }) -}}
130+
{% else -%}
131131
<div class="radio">
132-
{{ form_label(form, null, { widget: parent() }) }}
132+
{{- form_label(form, null, { widget: parent() }) -}}
133133
</div>
134-
{% endif %}
134+
{%- endif %}
135135
{%- endblock radio_widget %}
136136

137137
{# Labels #}
138138

139139
{% block form_label -%}
140-
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' control-label')|trim}) %}
140+
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' control-label')|trim}) -%}
141141
{{- parent() -}}
142142
{%- endblock form_label %}
143143

144-
{% block choice_label %}
144+
{% block choice_label -%}
145145
{# remove the checkbox-inline and radio-inline class, it's only useful for embed labels #}
146-
{% set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) %}
146+
{%- set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) -%}
147147
{{- block('form_label') -}}
148148
{% endblock %}
149149

@@ -168,8 +168,8 @@
168168
{% set label = name|humanize %}
169169
{% endif %}
170170
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
171-
{{ widget|raw }}
172-
{{ label is not sameas(false) ? label|trans({}, translation_domain) }}
171+
{{- widget|raw -}}
172+
{{- label is not sameas(false) ? label|trans({}, translation_domain) -}}
173173
</label>
174174
{% endif %}
175175
{% endblock checkbox_radio_label %}
@@ -178,9 +178,9 @@
178178

179179
{% block form_row -%}
180180
<div class="form-group{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
181-
{{ form_label(form) }}
182-
{{ form_widget(form) }}
183-
{{ form_errors(form) }}
181+
{{- form_label(form) -}}
182+
{{- form_widget(form) -}}
183+
{{- form_errors(form) -}}
184184
</div>
185185
{%- endblock form_row %}
186186

@@ -192,35 +192,35 @@
192192

193193
{% block choice_row -%}
194194
{% set force_error = true %}
195-
{{ block('form_row') }}
195+
{{- block('form_row') }}
196196
{%- endblock choice_row %}
197197

198198
{% block date_row -%}
199199
{% set force_error = true %}
200-
{{ block('form_row') }}
200+
{{- block('form_row') }}
201201
{%- endblock date_row %}
202202

203203
{% block time_row -%}
204204
{% set force_error = true %}
205-
{{ block('form_row') }}
205+
{{- block('form_row') }}
206206
{%- endblock time_row %}
207207

208208
{% block datetime_row -%}
209209
{% set force_error = true %}
210-
{{ block('form_row') }}
210+
{{- block('form_row') }}
211211
{%- endblock datetime_row %}
212212

213213
{% block checkbox_row -%}
214214
<div class="form-group{% if not valid %} has-error{% endif %}">
215-
{{ form_widget(form) }}
216-
{{ form_errors(form) }}
215+
{{- form_widget(form) -}}
216+
{{- form_errors(form) -}}
217217
</div>
218218
{%- endblock checkbox_row %}
219219

220220
{% block radio_row -%}
221221
<div class="form-group{% if not valid %} has-error{% endif %}">
222-
{{ form_widget(form) }}
223-
{{ form_errors(form) }}
222+
{{- form_widget(form) -}}
223+
{{- form_errors(form) -}}
224224
</div>
225225
{%- endblock radio_row %}
226226

@@ -231,7 +231,7 @@
231231
{% if form.parent %}<span class="help-block">{% else %}<div class="alert alert-danger">{% endif %}
232232
<ul class="list-unstyled">
233233
{%- for error in errors -%}
234-
<li><span class="glyphicon glyphicon-exclamation-sign"></span> {{ error.message }}</li>
234+
<li><span class="glyphicon glyphicon-exclamation-sign"></span>{{ error.message }}</li>
235235
{%- endfor -%}
236236
</ul>
237237
{% if form.parent %}</span>{% else %}</div>{% endif %}

0 commit comments

Comments
 (0)