k10r/twig-cs-fixer

Composer package to fix twig codestyle

This package's canonical repository appears to be gone and the package has been frozen as a result.

0.0.3 2022-02-23 17:04 UTC

This package is auto-updated.

Last update: 2024-03-06 12:05:12 UTC


README

Implemented Rules

Function Implemented
Indentation X
PipePrefixSpacing X
PipeSuffixSpacing X
SpaceLine X
TrailingSpace X
UppercaseVariables X
@var style
Your idea

Setup

  1. Go to your project folder and execute composer require k10r/twig-cs-fixer --dev
  2. Create a file named .twig_cs .twig_cs.dist or .twig_cs.dist.php
  3. (Optional) Adjust the executed fixers according to your needs
  4. Execute the fixer via vendor/bin/twig-cs-fixer

Known issues

  • JavaScript (eg. everything inside <script>-blocks) is not touched
  • Multiple calls for the same function example:{% set - some with and some without closing block
  • Attribute tags are not sorted
  • Multi-Line-Attributes with additional opening tag (eg. (, [) are not formatted correctly