Skip to content

Commit

Permalink
[AllBundles] Setup php-cs-fixer and add CI check
Browse files Browse the repository at this point in the history
  • Loading branch information
acrobat committed Oct 2, 2022
1 parent 22a1657 commit b3d6075
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 22 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,21 @@ jobs:

- name: Run phpstan
run: vendor/bin/phpstan analyse --no-progress

codestyle:
name: PHP codestyle
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none

- name: Install Composer Dependencies
uses: ramsey/composer-install@v1

- name: Run php-cs-fixer
run: vendor/bin/php-cs-fixer fix --dry-run --diff
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ npm-debug.log
.vscode
src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/layout/groundcontrol/dist
.idea
.php_cs
.php_cs.cache
.php-cs-fixer.php
.php-cs-fixer.cache
.phpunit.result.cache
!src/Kunstmaan/AdminBundle/Tests/Helper/VersionCheck/testdata/composer_*/composer.lock
22 changes: 22 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude([
'src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle',
'src/Kunstmaan/CookieBundle/Resources/skeleton',
'node_modules'
])
;

return (new PhpCsFixer\Config())
->setRiskyAllowed(false)
->setRules([
'@Symfony' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one']],
'concat_space' => ['spacing' => 'one'],
'phpdoc_summary' => false,
'yoda_style' => false,
'visibility_required' => ['elements' => ['property', 'method']],
])
->setFinder($finder);
18 changes: 0 additions & 18 deletions .php_cs.dist

This file was deleted.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
"matthiasnoback/symfony-dependency-injection-test": "^4.2.1",
"symfony/phpunit-bridge": "^6.1",
"phpunit/phpunit": "^9.5.5",
"friendsofphp/php-cs-fixer": "^2.13",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-doctrine": "^1.0"
"phpstan/phpstan-doctrine": "^1.0",
"php-cs-fixer/shim": "^3.11"
},
"replace": {
"kunstmaan/admin-bundle": "self.version",
Expand Down

0 comments on commit b3d6075

Please sign in to comment.