Skip to content

Commit d55cd49

Browse files
committed
Check code style against PSR-12
1 parent d523842 commit d55cd49

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/.gitattributes export-ignore
66
/.github export-ignore
77
/.gitignore export-ignore
8+
/phpcs.xml.dist export-ignore
89
/phpstan.neon.dist export-ignore
910
/phpunit.xml.dist export-ignore
1011
/psalm.xml.dist export-ignore

.github/workflows/tests.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ on:
55
pull_request: ~
66

77
jobs:
8+
phpcs:
9+
name: PHPCS
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: 7.1
18+
extensions: curl, mbstring
19+
coverage: none
20+
tools: composer:v2, cs2pr
21+
22+
- run: composer update --no-progress
23+
24+
- run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
25+
826
phpunit:
927
name: PHPUnit on ${{ matrix.php }} ${{ matrix.composer-flags }}
1028
runs-on: ubuntu-latest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
.phpcs-cache
12
.phpunit.result.cache
23
composer.lock
4+
phpcs.xml
35
phpstan.neon
46
phpunit.xml
57
psalm.xml

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"require-dev": {
2929
"phpstan/phpstan": "^0.12.42",
3030
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.3",
31+
"squizlabs/php_codesniffer": "^3.5",
3132
"vimeo/psalm": "^3.14"
3233
},
3334
"autoload": {

phpcs.xml.dist

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<arg name="basepath" value="."/>
4+
<arg name="extensions" value="php"/>
5+
<arg name="parallel" value="80"/>
6+
<arg name="cache" value=".phpcs-cache"/>
7+
<arg name="colors"/>
8+
9+
<!-- Ignore warnings, show progress of the run and show sniff names -->
10+
<arg value="nps"/>
11+
12+
<!-- Directories to be checked -->
13+
<file>src</file>
14+
<file>tests</file>
15+
16+
<rule ref="PSR12"/>
17+
</ruleset>

0 commit comments

Comments
 (0)