From df7f9b5aff7021e729b897b055ff6fcd83bd7a54 Mon Sep 17 00:00:00 2001 From: COil Date: Tue, 27 Jan 2026 07:57:48 +0100 Subject: [PATCH] feat: use vincentlanglet/twig-cs-fixer --- .gitignore | 4 ++ Makefile | 10 +++- composer.json | 1 + composer.lock | 140 +++++++++++++++++++++++++++++++++++++++++++++++++- symfony.lock | 9 ++++ 5 files changed, 161 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6088a2d..c9185ba 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,7 @@ bin/biome ###> misc ### .opencode/ ###< misc ### + +###> vincentlanglet/twig-cs-fixer ### +/.twig-cs-fixer.cache +###< vincentlanglet/twig-cs-fixer ### diff --git a/Makefile b/Makefile index 2b41bd8..6e57c70 100644 --- a/Makefile +++ b/Makefile @@ -98,6 +98,9 @@ fix-php: ## Fix PHP files with php-cs-fixer (ignore PHP version warning) fix-js-css: ## Format JS/CSS files with Biome @bin/biome check . --write +fix-twig-cs-fixer: ## Fix Twig files with Twig CS Fixer + @vendor/bin/twig-cs-fixer lint --fix ./templates + lint-php: ## Lint PHP files with php-cs-fixer (report only) lint-php: PHP_CS_FIXER_ARGS=--dry-run lint-php: fix-php @@ -114,14 +117,17 @@ lint-container: ## Lint the Symfony DI container lint-twig: ## Lint Twig files @bin/console lint:twig templates/ +lint-twig-cs-fixer: ## Lint Twig files with Twig CS Fixer + @vendor/bin/twig-cs-fixer lint ./templates + lint-doctrine: ## Validate Doctrine schema @bin/console doctrine:schema:validate fix: ## Run all fixers -fix: fix-php fix-js-css +fix: fix-php fix-js-css fix-twig-cs-fixer lint: ## Run all linters -lint: stan lint-php lint-doctrine lint-js-css lint-container lint-twig +lint: stan lint-php lint-doctrine lint-js-css lint-container lint-twig lint-twig-cs-fixer ci: ## Run CI locally ci: coverage warmup lint diff --git a/composer.json b/composer.json index 82bcfdb..b00d106 100644 --- a/composer.json +++ b/composer.json @@ -66,6 +66,7 @@ "symfony/requirements-checker": "^2.0", "symfony/stopwatch": "~8.0.0", "symfony/web-profiler-bundle": "~8.0.0", + "vincentlanglet/twig-cs-fixer": "^3.13", "zenstruck/foundry": "^2.4" }, "replace": { diff --git a/composer.lock b/composer.lock index 94de672..f56b997 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7a5cb5abfb96f9cb113b053088d584e5", + "content-hash": "4996ec40d1f8a9ae223f8bbfa4061765", "packages": [ { "name": "composer/semver", @@ -10257,6 +10257,144 @@ ], "time": "2025-12-08T11:19:18+00:00" }, + { + "name": "vincentlanglet/twig-cs-fixer", + "version": "3.13.0", + "source": { + "type": "git", + "url": "https://github.com/VincentLanglet/Twig-CS-Fixer.git", + "reference": "511e002e1e18203d26b173763ade29cbfd297750" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/VincentLanglet/Twig-CS-Fixer/zipball/511e002e1e18203d26b173763ade29cbfd297750", + "reference": "511e002e1e18203d26b173763ade29cbfd297750", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2.0.0", + "ext-ctype": "*", + "php": ">=8.0", + "symfony/console": "^5.4.9 || ^6.4 || ^7.0 || ^8.0", + "symfony/filesystem": "^5.4 || ^6.4 || ^7.0 || ^8.0", + "symfony/finder": "^5.4 || ^6.4 || ^7.0 || ^8.0", + "symfony/string": "^5.4.42 || ^6.4.10 || ~7.0.10 || ^7.1.3 || ^8.0", + "twig/twig": "^3.4", + "webmozart/assert": "^1.10 || ^2.0" + }, + "require-dev": { + "composer/semver": "^3.2.0", + "dereuromark/composer-prefer-lowest": "^0.1.10", + "ergebnis/composer-normalize": "^2.29", + "friendsofphp/php-cs-fixer": "^3.13.0", + "infection/infection": "^0.26.16 || ^0.32.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpstan/phpstan-symfony": "^2.0", + "phpstan/phpstan-webmozart-assert": "^2.0", + "phpunit/phpunit": "^9.5.26 || ^11.5.18 || ^12.1.3", + "rector/rector": "^2.0.0", + "shipmonk/composer-dependency-analyser": "^1.6", + "symfony/process": "^5.4 || ^6.4 || ^7.0 || ^8.0", + "symfony/twig-bridge": "^5.4 || ^6.4 || ^7.0 || ^8.0", + "symfony/ux-twig-component": "^2.2.0", + "twig/cache-extra": "^3.2" + }, + "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/3.13.0" + }, + "funding": [ + { + "url": "https://github.com/VincentLanglet", + "type": "github" + } + ], + "time": "2026-01-24T00:18:59+00:00" + }, + { + "name": "webmozart/assert", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "ce6a2f100c404b2d32a1dd1270f9b59ad4f57649" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/ce6a2f100c404b2d32a1dd1270f9b59ad4f57649", + "reference": "ce6a2f100c404b2d32a1dd1270f9b59ad4f57649", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-date": "*", + "ext-filter": "*", + "php": "^8.2" + }, + "suggest": { + "ext-intl": "", + "ext-simplexml": "", + "ext-spl": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-feature/2-0": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Woody Gilk", + "email": "woody.gilk@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/2.1.2" + }, + "time": "2026-01-13T14:02:24+00:00" + }, { "name": "zenstruck/assert", "version": "v1.7.0", diff --git a/symfony.lock b/symfony.lock index 1ab977b..f7f6d20 100644 --- a/symfony.lock +++ b/symfony.lock @@ -269,6 +269,15 @@ "twig/extra-bundle": { "version": "v3.5.1" }, + "vincentlanglet/twig-cs-fixer": { + "version": "3.13", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "3.0", + "ref": "d42582ae1bce86fd43491d6264c738b0867f8ffe" + } + }, "zenstruck/foundry": { "version": "2.8", "recipe": {