Skip to content

Commit

Permalink
Add php-cs-fixer (#677)
Browse files Browse the repository at this point in the history
* Apply php-cs-fixer

* Tidy
  • Loading branch information
inverse committed Oct 6, 2022
1 parent ead9acb commit c910612
Show file tree
Hide file tree
Showing 27 changed files with 1,706 additions and 444 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -21,6 +21,21 @@ jobs:
run: |
cd tasmoadmin
./vendor/bin/phpstan
php-cs-fixer:
name: Run PHPStan
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: '8.1'
- name: Install dependencies
run: composer install -d tasmoadmin/
- name: Run php-cs-fixer
run: |
cd tasmoadmin
./vendor/bin/php-cs-fixer fix --dry-run
php-tests:
name: Run PHP tests
runs-on: ubuntu-20.04
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -29,6 +29,7 @@
/tasmoadmin/vendor/
.phpunit.result.cache
/tasmoadmin/coverage.xml
.php-cs-fixer.cache

!.empty
!.htaccess
Expand Down
20 changes: 20 additions & 0 deletions tasmoadmin/.php-cs-fixer.dist.php
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->in(['src', 'tests'])
;

$config = new PhpCsFixer\Config();

$config
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@PSR12' => true,
])
->setFinder($finder)
;

return $config;
3 changes: 2 additions & 1 deletion tasmoadmin/composer.json
Expand Up @@ -24,7 +24,8 @@
"require-dev": {
"phpunit/phpunit": "^9.3.8",
"mikey179/vfsstream": "^1.6",
"phpstan/phpstan": "^1.6"
"phpstan/phpstan": "^1.6",
"friendsofphp/php-cs-fixer": "^3.11"
},
"autoload-dev": {
"psr-4": {
Expand Down

0 comments on commit c910612

Please sign in to comment.