Skip to content

Commit d72e6ad

Browse files
authored
Add php cs fixer (#47)
1 parent f460e10 commit d72e6ad

File tree

9 files changed

+415
-360
lines changed

9 files changed

+415
-360
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@ jobs:
2121
ini-values: post_max_size=256M, max_execution_time=180
2222
tools: composer:v2
2323

24-
- name: Test
25-
env:
26-
STREAM_API_KEY: ${{ secrets.STREAM_API_KEY }}
27-
STREAM_API_SECRET: ${{ secrets.STREAM_API_SECRET }}
28-
run: |
29-
composer install --no-interaction
30-
vendor/bin/phpunit
24+
- name: Deps
25+
run: composer install --no-interaction
26+
27+
- name: Format
28+
run: vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation
3129

3230
- name: Quality
3331
if: matrix.php-versions == '7.4'
3432
run: vendor/bin/phan --force-polyfill-parser || true
33+
34+
- name: Test
35+
env:
36+
STREAM_API_KEY: ${{ secrets.STREAM_API_KEY }}
37+
STREAM_API_SECRET: ${{ secrets.STREAM_API_SECRET }}
38+
run: vendor/bin/phpunit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ composer.lock
44
.phplint-cache
55
.phpunit.result.cache
66
.envrc
7+
.php_cs.cache

.php_cs.dist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->exclude('vendor')
5+
->in(__DIR__)
6+
;
7+
8+
$config = new PhpCsFixer\Config();
9+
return $config->setRules([
10+
'@PSR2' => true,
11+
'array_syntax' => ['syntax' => 'short'],
12+
])
13+
->setFinder($finder)
14+
;

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"firebase/php-jwt": "^v5.0.0"
1616
},
1717
"require-dev": {
18+
"friendsofphp/php-cs-fixer": "^2.18.0",
1819
"phan/phan": "^4.0.3",
1920
"phpunit/phpunit": "^8.2.1",
2021
"ramsey/uuid": "^3.8.0"

0 commit comments

Comments
 (0)