Download the PHP package jadu/twig-style without Composer
On this page you can find all versions of the php package jadu/twig-style. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jadu/twig-style
More information about jadu/twig-style
Files in jadu/twig-style
Package twig-style
Short Description Jadu Twig coding style configuration for Twig-CS-Fixer
License proprietary
Informations about the package twig-style
Jadu Twig Style
Jadu Twig style is powered by Twig-CS-Fixer.
Installation
-
Require the jadu/twig-style dev dependency:
-
Add the twig-cs-fixer config file
.twig-cs-fixer.php
: - Add
.twig-cs-fixer.cache
to your project's.gitignore
file.
Usage
Dry run
To lint your project's twig files, run the following dry run command:
This command will return a list of twig-cs-fixer violations and is recommended for build tasks.
Fix
To fix any reported fixable violations, run the following fix command:
Jadu Twig Coding Standard Rules
This standard is based on the official Twig coding standards, with the following additions and changes:
Block spacing and new lines
There must be one new line before block tags and one new line after endblock tags.
The following exceptions apply:
-
Inline blocks are allowed.
- Comments on the line above block tags are allowed.
Endblock names
Any endblock
tags must be followed by the name of the block they are closing.
No spaceless tags
The spaceless
tag was deprecated in Twig 1.38 and 2.7.3^1 and an equivalent spaceless
filter was introduced. Usages of the spaceless
tag must be replaced with the equivalent apply spaceless
filter.
No filter tags
The filter
tag was deprecated in Twig 1.40^2 and 2.9^3 in favour of the apply
tag, which behaves identically to filter
except that the wrapped template data is not scoped. Usages of the filter
tag must be replaced with the equivalent apply
tag.
Punctuation spacing
A single space is required after the opening and before the closing of a hash.
The following exceptions apply:
- Empty hashes must not contain any whitespace.
Variable names
Variable naming conventions are not enforced.
Development
The rules in the Jadu\Style\Twig\Rule\Development
namespace are provided for development purposes to help with maintaining Jadu Twig style.
You will need to update your project's twig-cs-fixer config file .twig-cs-fixer.php
to enable these rules, as non-fixable rules are disabled by default.
TokenTypeRule
helps you see how a twig template is tokenized by Twig-CS-Fixer by mapping token types to values.
All versions of twig-style with dependencies
vincentlanglet/twig-cs-fixer Version ^2.0.0
webmozart/assert Version ^1.10.0