Skip to content

Commit 053aa39

Browse files
authored
Add phpstan (#28)
1 parent 3df5fd6 commit 053aa39

File tree

5 files changed

+49
-4
lines changed

5 files changed

+49
-4
lines changed

.github/workflows/phpstan.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 }}-php-${{ hashFiles('**/composer.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-php-
30+
- name: Install dependencies
31+
if: steps.composer-cache.outputs.cache-hit != 'true'
32+
run: |
33+
composer install
34+
composer dump
35+
- name: Run analyse phpstan
36+
run: vendor/bin/phpstan analyse --error-format github

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/vendor
22
/build
3-
composer.lock
3+
/composer.lock
44
/tests/tmp
5-
/.phpunit.result.cache
65
/phpunit.xml
6+
/.phpunit.result.cache
7+
/.php-cs-fixer.cache

.php-cs-fixer.cache

Lines changed: 0 additions & 1 deletion
This file was deleted.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"require-dev": {
3030
"orchestra/testbench": "^7.0",
3131
"phpunit/phpunit": "^9.5",
32-
"friendsofphp/php-cs-fixer": "^3.13"
32+
"friendsofphp/php-cs-fixer": "^3.13",
33+
"nunomaduro/larastan": "^2.3"
3334
},
3435
"autoload": {
3536
"psr-4": {

phpstan.neon.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
includes:
2+
- ./vendor/nunomaduro/larastan/extension.neon
3+
4+
parameters:
5+
paths:
6+
- src
7+
- tests
8+
level: 5

0 commit comments

Comments
 (0)