diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c887c84d..ccb6d2d3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,6 +22,18 @@ jobs: uses: actions/checkout@v4 - name: Fix CS uses: docker://oskarstark/php-cs-fixer-ga + twig-cs-fixer: + runs-on: ubuntu-22.04 + name: Twig-CS-Fixer + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Require the vendor + run: composer require --dev --no-update vincentlanglet/twig-cs-fixer ^2.12 + - name: Update + run: composer update --no-interaction --no-progress + - name: Run + run: vendor/bin/twig-cs-fixer lint src/Knp/Menu/Resources/views tests: runs-on: ubuntu-22.04 strategy: diff --git a/src/Knp/Menu/Resources/views/knp_menu.html.twig b/src/Knp/Menu/Resources/views/knp_menu.html.twig index 0ac53f64..6bb65cc7 100644 --- a/src/Knp/Menu/Resources/views/knp_menu.html.twig +++ b/src/Knp/Menu/Resources/views/knp_menu.html.twig @@ -34,11 +34,11 @@ {% set currentItem = item %} {# update the depth for children #} {% if options.depth is not none %} -{% set options = options|merge({'depth': currentOptions.depth - 1}) %} +{% set options = options|merge({depth: currentOptions.depth - 1}) %} {% endif %} {# update the matchingDepth for children #} {% if options.matchingDepth is not none and options.matchingDepth > 0 %} -{% set options = options|merge({'matchingDepth': currentOptions.matchingDepth - 1}) %} +{% set options = options|merge({matchingDepth: currentOptions.matchingDepth - 1}) %} {% endif %} {% for item in currentItem.children %} {{ block('item') }} @@ -75,7 +75,7 @@ {%- set attributes = item.attributes %} {%- if classes is not empty %} - {%- set attributes = attributes|merge({'class': classes|join(' ')}) %} + {%- set attributes = attributes|merge({class: classes|join(' ')}) %} {%- endif %} {# displaying the item #} {% import _self as knp_menu %} @@ -85,10 +85,10 @@ {%- else %} {{ block('spanElement') }} {%- endif %} -{# render the list of children#} +{# render the list of children #} {%- set childrenClasses = item.childrenAttribute('class') is not empty ? [item.childrenAttribute('class')] : [] %} {%- set childrenClasses = childrenClasses|merge(['menu_level_' ~ item.level]) %} - {%- set listAttributes = item.childrenAttributes|merge({'class': childrenClasses|join(' ') }) %} + {%- set listAttributes = item.childrenAttributes|merge({class: childrenClasses|join(' ')}) %} {{ block('list') }} {% endif %}