diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6913425..c992c52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..24f1d1f --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,11 @@ +in(__DIR__) +; + +return Retailcrm\PhpCsFixer\Defaults::rules() + ->setFinder($finder) + ->setCacheFile(__DIR__ . '/.php_cs.cache'); diff --git a/Makefile b/Makefile index 4a4f445..1555a58 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/composer.json b/composer.json index 662e712..13f9670 100644 --- a/composer.json +++ b/composer.json @@ -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",