Add php-cs-fixer

This commit is contained in:
Ilyas Salikhov 2024-10-01 15:53:49 +03:00
parent 5bad727da1
commit cb69478c78
4 changed files with 19 additions and 0 deletions

View File

@ -40,5 +40,8 @@ jobs:
- name: Validate composer
run: composer validate --strict --no-check-lock
- name: "Run code-style check"
run: vendor/bin/php-cs-fixer fix --dry-run --config=.php-cs-fixer.dist.php --using-cache=no --show-progress=none -v
- name: Run tests
run: vendor/bin/phpunit

11
.php-cs-fixer.dist.php Normal file
View File

@ -0,0 +1,11 @@
<?php
require_once __DIR__ . '/vendor/autoload.php';
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;
return Retailcrm\PhpCsFixer\Defaults::rules()
->setFinder($finder)
->setCacheFile(__DIR__ . '/.php_cs.cache');

View File

@ -10,6 +10,9 @@ vendor: composer.json
@$(PHP) composer install -o -n --no-ansi
@touch vendor || true
php-cs: $(PHP_CONSOLE_DEPS)
@$(PHP) vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --using-cache=no -v
phpunit: $(PHP_CONSOLE_DEPS)
@$(PHP) vendor/bin/phpunit --color=always

View File

@ -24,10 +24,12 @@
},
"require-dev": {
"doctrine/annotations": "^1.0",
"friendsofphp/php-cs-fixer": "^3",
"friendsofsymfony/rest-bundle": "^3.7",
"jms/serializer": "^3.15",
"jms/serializer-bundle": "^4.1|^5.4",
"phpunit/phpunit": "~9.5",
"retailcrm/php-code-style": "^1",
"symfony/asset": "^5.0|^6.0",
"symfony/browser-kit": "^5.0|^6.0",
"symfony/translation": "^5.0|^6.0",