Skip to content

Commit 7bf16fe

Browse files
committed
add phpstan
1 parent 1740043 commit 7bf16fe

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

.github/workflows/phpstan.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: phpstan
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
phpstan:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: 8.1
21+
22+
- name: Cache Composer packages
23+
id: composer-cache
24+
uses: actions/cache@v3
25+
with:
26+
path: vendor
27+
key: ${{ runner.os }}-php81-${{ hashFiles('**/composer.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-php81-
30+
31+
- name: Install dependencies
32+
if: steps.composer-cache.outputs.cache-hit != 'true'
33+
run: |
34+
composer install
35+
composer dump
36+
37+
- name: Run analyse phpstan
38+
run: vendor/bin/phpstan analyse --error-format github

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"test": "vendor/bin/phpunit"
3333
},
3434
"require-dev": {
35-
"phpunit/phpunit": "^9.0"
35+
"phpunit/phpunit": "^9.0",
36+
"phpstan/phpstan": "^1.9"
3637
}
3738
}

phpstan.neon.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
parameters:
2+
3+
paths:
4+
- src
5+
- tests
6+
7+
# The level 9 is the highest level
8+
level: 5

0 commit comments

Comments
 (0)