#1 [Ticket] Adding Twig CS Fixer

This commit is contained in:
Snoweuph 2024-02-19 22:23:07 +01:00
parent c86d85c99f
commit 2d8927af40
Signed by: Snoweuph
GPG key ID: A494330694B208EF
5 changed files with 166 additions and 2 deletions

4
app/.gitignore vendored
View file

@ -35,3 +35,7 @@ phpstan.dist.neon
# Encore Daemon # Encore Daemon
/npm-watch.pid /npm-watch.pid
###> vincentlanglet/twig-cs-fixer ###
/.twig-cs-fixer.cache
###< vincentlanglet/twig-cs-fixer ###

12
app/.twig-cs-fixer.php Normal file
View file

@ -0,0 +1,12 @@
<?php
$ruleset = new TwigCsFixer\Ruleset\Ruleset();
$ruleset->addStandard(new TwigCsFixer\Standard\Twig());
$ruleset->addRule(new TwigCsFixer\Rules\Whitespace\EmptyLinesRule());
$ruleset->addRule(new TwigCsFixer\Rules\Variable\VariableNameRule(TwigCsFixer\Rules\Variable\VariableNameRule::CAMEL_CASE));
$config = new TwigCsFixer\Config\Config();
$config->setRuleset($ruleset);
$config->allowNonFixableRules();
return $config;

View file

@ -88,6 +88,7 @@
"symfony/css-selector": "6.3.*", "symfony/css-selector": "6.3.*",
"symfony/debug-bundle": "6.3.*", "symfony/debug-bundle": "6.3.*",
"symfony/phpunit-bridge": "^7.0", "symfony/phpunit-bridge": "^7.0",
"symfony/web-profiler-bundle": "6.3.*" "symfony/web-profiler-bundle": "6.3.*",
"vincentlanglet/twig-cs-fixer": "^2.4"
} }
} }

140
app/composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "da2d735419ac40bad64d8d4693a99044", "content-hash": "2570c00daac6d35734750c2b68354551",
"packages": [ "packages": [
{ {
"name": "doctrine/cache", "name": "doctrine/cache",
@ -8212,6 +8212,144 @@
} }
], ],
"time": "2023-11-20T00:12:19+00:00" "time": "2023-11-20T00:12:19+00:00"
},
{
"name": "vincentlanglet/twig-cs-fixer",
"version": "2.4.4",
"source": {
"type": "git",
"url": "https://github.com/VincentLanglet/Twig-CS-Fixer.git",
"reference": "f9e76645b81df65d64d09d88ce05eaae34def8b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/VincentLanglet/Twig-CS-Fixer/zipball/f9e76645b81df65d64d09d88ce05eaae34def8b6",
"reference": "f9e76645b81df65d64d09d88ce05eaae34def8b6",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2.0.0",
"ext-ctype": "*",
"ext-json": "*",
"php": ">=8.0",
"symfony/console": "^5.4.9 || ^6.0 || ^7.0",
"symfony/filesystem": "^5.4 || ^6.0 || ^7.0",
"symfony/finder": "^5.4 || ^6.0 || ^7.0",
"symfony/string": "^5.4 || ^6.0 || ^7.0",
"twig/twig": "^2.14.0 || ^3.0.5",
"webmozart/assert": "^1.10"
},
"require-dev": {
"dereuromark/composer-prefer-lowest": "^0.1.10",
"ergebnis/composer-normalize": "^2.29",
"friendsofphp/php-cs-fixer": "^3.13.0",
"icanhazstring/composer-unused": "^0.8.5",
"infection/infection": "^0.26.16 || ^0.27.0",
"maglnet/composer-require-checker": "^3.8 || ^4.3",
"phpstan/phpstan": "^1.9.1",
"phpstan/phpstan-phpunit": "^1.2.2",
"phpstan/phpstan-strict-rules": "^1.4.4",
"phpstan/phpstan-symfony": "^1.2.16",
"phpstan/phpstan-webmozart-assert": "^1.2.2",
"phpunit/phpunit": "^9.5.26 || ^10.0.9",
"psalm/plugin-phpunit": "^0.18.4",
"psalm/plugin-symfony": "^5.0.0",
"rector/rector": "^1.0.0",
"symfony/process": "^5.4 || ^6.0 || ^7.0",
"symfony/twig-bridge": "^5.4 || ^6.0 || ^7.0",
"symfony/ux-twig-component": "^2.2.0",
"twig/cache-extra": "^3.2",
"vimeo/psalm": "^5.2.0"
},
"bin": [
"bin/twig-cs-fixer"
],
"type": "coding-standard",
"autoload": {
"psr-4": {
"TwigCsFixer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Vincent Langlet"
}
],
"description": "A tool to automatically fix Twig code style",
"homepage": "https://github.com/VincentLanglet/Twig-CS-Fixer",
"support": {
"issues": "https://github.com/VincentLanglet/Twig-CS-Fixer/issues",
"source": "https://github.com/VincentLanglet/Twig-CS-Fixer/tree/2.4.4"
},
"funding": [
{
"url": "https://github.com/VincentLanglet",
"type": "github"
}
],
"time": "2024-02-19T10:17:09+00:00"
},
{
"name": "webmozart/assert",
"version": "1.11.0",
"source": {
"type": "git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"php": "^7.2 || ^8.0"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<4.6.1 || 4.6.2"
},
"require-dev": {
"phpunit/phpunit": "^8.5.13"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"support": {
"issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
},
"time": "2022-06-03T18:03:27+00:00"
} }
], ],
"aliases": [], "aliases": [],

View file

@ -253,5 +253,14 @@
}, },
"twig/extra-bundle": { "twig/extra-bundle": {
"version": "v3.7.1" "version": "v3.7.1"
},
"vincentlanglet/twig-cs-fixer": {
"version": "2.4",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "main",
"version": "0.6",
"ref": "e4da12a48e8138479bd24a675321bcfd84950266"
}
} }
} }