diff --git a/.github/workflows/ci-php.yml b/.github/workflows/ci-php.yml index 91dbb858..18dffaff 100644 --- a/.github/workflows/ci-php.yml +++ b/.github/workflows/ci-php.yml @@ -18,7 +18,10 @@ jobs: run: composer install --no-progress --no-suggest - name: PHPStan - run: vendor/bin/phpstan + run: composer phpstan + + - name: CS check + run: composer cs-check - name: Run test suite - run: vendor/bin/phpunit --testsuite=unit + run: composer test diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 00000000..059312bb --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,18 @@ +in(__DIR__) + ->exclude('var') + ->exclude('vendor') + ->exclude('examples') +; + +return (new PhpCsFixer\Config()) + ->setRules([ + '@PSR12' => true, + 'no_unused_imports' => true, + 'full_opening_tag' => true, + ]) + ->setFinder($finder) + ->setCacheFile(__DIR__.'/var/.php-cs-fixer.cache') +; diff --git a/composer.json b/composer.json index ee42d1ca..7bd939a6 100644 --- a/composer.json +++ b/composer.json @@ -37,6 +37,7 @@ }, "require-dev": { "escapestudios/symfony2-coding-standard": "^3.11", + "friendsofphp/php-cs-fixer": "^3.65", "monolog/monolog": "^2.8", "php-http/curl-client": "^2.2", "phpstan/phpstan": "^2.0", @@ -62,6 +63,8 @@ "test": "./vendor/bin/phpunit --testsuite=unit", "phpstan": "./vendor/bin/phpstan", "baseline": "./vendor/bin/phpstan --generate-baseline", - "rector": "./vendor/bin/rector" + "rector": "./vendor/bin/rector", + "cs-fix": "./vendor/bin/php-cs-fixer fix", + "cs-check": "./vendor/bin/php-cs-fixer fix --dry-run --diff" } }