Skip to content

Commit

Permalink
refactor: install php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
mustapayev committed Dec 28, 2024
1 parent 672ba4b commit e259d3c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 18 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$finder = (new PhpCsFixer\Finder())
->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')
;
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
}

0 comments on commit e259d3c

Please sign in to comment.