29 - Add PHP-CS-Fixer
This commit is contained in:
parent
41a984950f
commit
57dcabc44f
6 changed files with 1201 additions and 1 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -17,3 +17,8 @@
|
|||
###> phpstan/phpstan ###
|
||||
phpstan.neon
|
||||
###< phpstan/phpstan ###
|
||||
|
||||
###> friendsofphp/php-cs-fixer ###
|
||||
/.php-cs-fixer.php
|
||||
/.php-cs-fixer.cache
|
||||
###< friendsofphp/php-cs-fixer ###
|
||||
|
|
|
|||
20
.php-cs-fixer.dist.php
Normal file
20
.php-cs-fixer.dist.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
$finder = (new PhpCsFixer\Finder())
|
||||
->in(__DIR__)
|
||||
->exclude('var')
|
||||
// Auto-generated Symfony config files — not hand-written source, and the
|
||||
// risky ruleset mangles prose like "@type" inside their doc comments.
|
||||
->notPath('config/bundles.php')
|
||||
->notPath('config/reference.php');
|
||||
|
||||
return (new PhpCsFixer\Config())
|
||||
->setRiskyAllowed(true)
|
||||
// PHP 8.4 may be newer than the fixer officially supports; allow it explicitly.
|
||||
->setUnsupportedPhpVersionAllowed(true)
|
||||
->setRules([
|
||||
'@Symfony' => true,
|
||||
'@Symfony:risky' => true,
|
||||
])
|
||||
->setFinder($finder)
|
||||
->setCacheFile('var/.php-cs-fixer.cache');
|
||||
|
|
@ -85,6 +85,7 @@
|
|||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.95",
|
||||
"phpstan/extension-installer": "^1.4",
|
||||
"phpstan/phpstan": "^2.2",
|
||||
"phpstan/phpstan-doctrine": "^2.0",
|
||||
|
|
|
|||
1152
composer.lock
generated
1152
composer.lock
generated
File diff suppressed because it is too large
Load diff
12
shell.nix
12
shell.nix
|
|
@ -109,6 +109,16 @@ pkgs.mkShell {
|
|||
$COMPOSE exec php vendor/bin/phpstan analyse --memory-limit=512M "$@"
|
||||
}
|
||||
|
||||
dev-cs() {
|
||||
# Dry-run code-style check (no changes). Use for CI / verification.
|
||||
$COMPOSE exec php vendor/bin/php-cs-fixer check --diff "$@"
|
||||
}
|
||||
|
||||
dev-cs-fix() {
|
||||
# Apply code-style fixes in place.
|
||||
$COMPOSE exec php vendor/bin/php-cs-fixer fix "$@"
|
||||
}
|
||||
|
||||
# ===================
|
||||
# BUILD COMMANDS
|
||||
# ===================
|
||||
|
|
@ -162,6 +172,8 @@ pkgs.mkShell {
|
|||
echo " dev-composer <cmd> Run composer in the container"
|
||||
echo " dev-test [args] Run PHPUnit (bin/phpunit)"
|
||||
echo " dev-stan [args] Run PHPStan static analysis"
|
||||
echo " dev-cs [args] Check code style (dry-run)"
|
||||
echo " dev-cs-fix [args] Apply code style fixes"
|
||||
echo " base-build Build and push image"
|
||||
echo ""
|
||||
echo "Services:"
|
||||
|
|
|
|||
12
symfony.lock
12
symfony.lock
|
|
@ -49,6 +49,18 @@
|
|||
"migrations/.gitignore"
|
||||
]
|
||||
},
|
||||
"friendsofphp/php-cs-fixer": {
|
||||
"version": "3.95",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "3.39",
|
||||
"ref": "97aaf9026490db73b86c23d49e5774bc89d2b232"
|
||||
},
|
||||
"files": [
|
||||
".php-cs-fixer.dist.php"
|
||||
]
|
||||
},
|
||||
"nelmio/cors-bundle": {
|
||||
"version": "2.6",
|
||||
"recipe": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue