From 850a8c2e211de2de2feab081eadbeb762a4eee8b Mon Sep 17 00:00:00 2001 From: Jan Rosier Date: Sun, 12 Oct 2025 17:05:58 +0200 Subject: [PATCH] Apply Twig coding standard rules --- templates/admin/blog/_form.html.twig | 2 +- templates/admin/blog/edit.html.twig | 6 +++--- templates/admin/blog/show.html.twig | 2 +- templates/admin/layout.html.twig | 1 - templates/base.html.twig | 6 +++--- templates/blog/_comment_form.html.twig | 2 +- templates/blog/_post_tags.html.twig | 3 +-- templates/blog/index.xml.twig | 10 +++++----- templates/blog/post_show.html.twig | 4 ++-- templates/blog/search.html.twig | 2 +- templates/bundles/TwigBundle/Exception/error.html.twig | 6 +++--- .../bundles/TwigBundle/Exception/error403.html.twig | 2 +- .../bundles/TwigBundle/Exception/error404.html.twig | 4 ++-- .../bundles/TwigBundle/Exception/error500.html.twig | 4 ++-- templates/form/fields.html.twig | 2 +- 15 files changed, 27 insertions(+), 29 deletions(-) diff --git a/templates/admin/blog/_form.html.twig b/templates/admin/blog/_form.html.twig index 1830e6687..2d57908ae 100644 --- a/templates/admin/blog/_form.html.twig +++ b/templates/admin/blog/_form.html.twig @@ -14,7 +14,7 @@ {{ form_start(form, {attr: attr|default({})}) }} {{ form_widget(form) }} - diff --git a/templates/admin/blog/edit.html.twig b/templates/admin/blog/edit.html.twig index 4b9167cc6..3462a16a7 100644 --- a/templates/admin/blog/edit.html.twig +++ b/templates/admin/blog/edit.html.twig @@ -3,13 +3,13 @@ {% block body_id 'admin_post_edit' %} {% block main %} -

{{ 'title.edit_post'|trans({'id': post.id}) }}

+

{{ 'title.edit_post'|trans({id: post.id}) }}

{{ include('admin/blog/_form.html.twig', { form: form, button_label: 'action.save'|trans, include_back_to_home_link: true, - }, with_context = false) }} + }, with_context: false) }} {% endblock %} {% block sidebar %} @@ -20,7 +20,7 @@
- {{ include('admin/blog/_delete_form.html.twig', {post: post}, with_context = false) }} + {{ include('admin/blog/_delete_form.html.twig', {post: post}, with_context: false) }}
{{ parent() }} diff --git a/templates/admin/blog/show.html.twig b/templates/admin/blog/show.html.twig index 3b8bdc447..e283113bf 100644 --- a/templates/admin/blog/show.html.twig +++ b/templates/admin/blog/show.html.twig @@ -27,7 +27,7 @@
- {{ include('admin/blog/_delete_form.html.twig', {post: post}, with_context = false) }} + {{ include('admin/blog/_delete_form.html.twig', {post: post}, with_context: false) }}
{{ parent() }} diff --git a/templates/admin/layout.html.twig b/templates/admin/layout.html.twig index abda03dba..42e3e1dcf 100644 --- a/templates/admin/layout.html.twig +++ b/templates/admin/layout.html.twig @@ -24,4 +24,3 @@ {% endblock %} - diff --git a/templates/base.html.twig b/templates/base.html.twig index 0e5a0434a..44a68378e 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -99,9 +99,9 @@ diff --git a/templates/blog/_comment_form.html.twig b/templates/blog/_comment_form.html.twig index b1f3c948b..e802d704c 100644 --- a/templates/blog/_comment_form.html.twig +++ b/templates/blog/_comment_form.html.twig @@ -6,7 +6,7 @@ {{ form_start(form, {method: ..., action: ..., attr: {novalidate: 'novalidate'}}) }} #} -{{ form_start(form, {method: 'POST', action: path('comment_new', {'postSlug': post.slug})}) }} +{{ form_start(form, {method: 'POST', action: path('comment_new', {postSlug: post.slug})}) }} {# Instead of displaying form fields one by one, you can also display them all with their default options and styles just by calling to this function: diff --git a/templates/blog/_post_tags.html.twig b/templates/blog/_post_tags.html.twig index 81b88417b..799124708 100644 --- a/templates/blog/_post_tags.html.twig +++ b/templates/blog/_post_tags.html.twig @@ -1,7 +1,7 @@ {% if not post.tags.empty %}

{% for tag in post.tags %} - {{ tag.name }} @@ -9,4 +9,3 @@ {% endfor %}

{% endif %} - diff --git a/templates/blog/index.xml.twig b/templates/blog/index.xml.twig index 2a9cd5319..53aa38397 100644 --- a/templates/blog/index.xml.twig +++ b/templates/blog/index.xml.twig @@ -3,8 +3,8 @@ {{ 'rss.title'|trans }} {{ 'rss.description'|trans }} - {{ 'now'|date('r', timezone='GMT') }} - {{ (paginator.results|last).publishedAt|default('now')|date('r', timezone='GMT') }} + {{ 'now'|date('r', timezone: 'GMT') }} + {{ (paginator.results|last).publishedAt|default('now')|date('r', timezone: 'GMT') }} {{ url('blog_index') }} {{ app.locale }} @@ -12,9 +12,9 @@ {{ post.title }} {{ post.summary }} - {{ url('blog_post', {'slug': post.slug}) }} - {{ url('blog_post', {'slug': post.slug}) }} - {{ post.publishedAt|date(format='r', timezone='GMT') }} + {{ url('blog_post', {slug: post.slug}) }} + {{ url('blog_post', {slug: post.slug}) }} + {{ post.publishedAt|date(format: 'r', timezone: 'GMT') }} {{ post.author.email }} {% for tag in post.tags %} {{ tag.name }} diff --git a/templates/blog/post_show.html.twig b/templates/blog/post_show.html.twig index 87b3ffaa6..802523f9a 100644 --- a/templates/blog/post_show.html.twig +++ b/templates/blog/post_show.html.twig @@ -30,7 +30,7 @@ {{ render(controller('App\\Controller\\BlogController::commentForm', {post})) }} {% else %}

- + {{ 'action.sign_in'|trans }} {{ 'post.to_publish_a_comment'|trans }} @@ -39,7 +39,7 @@

- {{ 'post.num_comments'|trans({ 'count': post.comments|length }) }} + {{ 'post.num_comments'|trans({count: post.comments|length}) }}

{% for comment in post.comments %} diff --git a/templates/blog/search.html.twig b/templates/blog/search.html.twig index e3807d902..f3d890a42 100644 --- a/templates/blog/search.html.twig +++ b/templates/blog/search.html.twig @@ -8,7 +8,7 @@ See https://symfony.com/bundles/ux-twig-component/current/index.html #} {{ component('blog_search', { - query: query + query: query, }) }} {% endblock %} diff --git a/templates/bundles/TwigBundle/Exception/error.html.twig b/templates/bundles/TwigBundle/Exception/error.html.twig index 28ab5d914..c0ce81e2d 100644 --- a/templates/bundles/TwigBundle/Exception/error.html.twig +++ b/templates/bundles/TwigBundle/Exception/error.html.twig @@ -13,13 +13,13 @@ {% block body_id 'error' %} {% block main %} -

{{ 'http_error.name'|trans({ 'status_code': status_code }) }}

+

{{ 'http_error.name'|trans({status_code: status_code}) }}

- {{ 'http_error.description'|trans({ 'status_code': status_code }) }} + {{ 'http_error.description'|trans({status_code: status_code}) }}

- {{ 'http_error.suggestion'|trans({ 'url': path('blog_index') })|raw }} + {{ 'http_error.suggestion'|trans({url: path('blog_index')})|raw }}

{% endblock %} diff --git a/templates/bundles/TwigBundle/Exception/error403.html.twig b/templates/bundles/TwigBundle/Exception/error403.html.twig index 134d11e37..889dc3f01 100644 --- a/templates/bundles/TwigBundle/Exception/error403.html.twig +++ b/templates/bundles/TwigBundle/Exception/error403.html.twig @@ -13,7 +13,7 @@ {% block body_id 'error' %} {% block main %} -

{{ 'http_error.name'|trans({ 'status_code': 403 }) }}

+

{{ 'http_error.name'|trans({status_code: 403}) }}

{{ 'http_error_403.description'|trans }} diff --git a/templates/bundles/TwigBundle/Exception/error404.html.twig b/templates/bundles/TwigBundle/Exception/error404.html.twig index 07c6b245f..6cccc2ae7 100644 --- a/templates/bundles/TwigBundle/Exception/error404.html.twig +++ b/templates/bundles/TwigBundle/Exception/error404.html.twig @@ -13,13 +13,13 @@ {% block body_id 'error' %} {% block main %} -

{{ 'http_error.name'|trans({ 'status_code': 404 }) }}

+

{{ 'http_error.name'|trans({status_code: 404}) }}

{{ 'http_error_404.description'|trans }}

- {{ 'http_error_404.suggestion'|trans({ 'url': path('blog_index') })|raw }} + {{ 'http_error_404.suggestion'|trans({url: path('blog_index')})|raw }}

{% endblock %} diff --git a/templates/bundles/TwigBundle/Exception/error500.html.twig b/templates/bundles/TwigBundle/Exception/error500.html.twig index 475b5ae81..676c83355 100644 --- a/templates/bundles/TwigBundle/Exception/error500.html.twig +++ b/templates/bundles/TwigBundle/Exception/error500.html.twig @@ -13,13 +13,13 @@ {% block body_id 'error' %} {% block main %} -

{{ 'http_error.name'|trans({ 'status_code': 500 }) }}

+

{{ 'http_error.name'|trans({status_code: 500}) }}

{{ 'http_error_500.description'|trans }}

- {{ 'http_error_500.suggestion'|trans({ 'url': path('blog_index') })|raw }} + {{ 'http_error_500.suggestion'|trans({url: path('blog_index')})|raw }}

{% endblock %} diff --git a/templates/form/fields.html.twig b/templates/form/fields.html.twig index 4ba9dcdf3..8b96e9be1 100644 --- a/templates/form/fields.html.twig +++ b/templates/form/fields.html.twig @@ -17,7 +17,7 @@ {% block tags_input_widget %}
- {{ form_widget(form, {'attr': {'data-toggle': 'tagsinput', 'data-tags': tags|json_encode}}) }} + {{ form_widget(form, {attr: {'data-toggle': 'tagsinput', 'data-tags': tags|json_encode}}) }}
{% endblock %}