Skip to content

Commit e82873e

Browse files
committed
Add static analysis with phpstan
1 parent 012d3a4 commit e82873e

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- 3.x
1010

1111
jobs:
12-
run:
12+
tests:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
fail-fast: false
@@ -56,3 +56,21 @@ jobs:
5656
- name: Run PHPUnit tests
5757
run: |
5858
./vendor/bin/simple-phpunit
59+
60+
phpstan:
61+
runs-on: ubuntu-latest
62+
name: PHPStan
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
67+
- name: Setup PHP
68+
uses: shivammathur/setup-php@v2
69+
with:
70+
php-version: '8.4'
71+
72+
- name: Install dependencies
73+
run: composer update
74+
75+
- name: Run analysis
76+
run: ./vendor/bin/phpstan

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@
5050
},
5151
"require-dev": {
5252
"doctrine/doctrine-bundle": "^1.3 || ^2",
53+
"doctrine/orm": "^2.6.3 || ^3",
5354
"friendsofphp/php-cs-fixer": "^3.0.2, !=3.5.0",
55+
"phpstan/phpstan": "^2.1",
56+
"phpstan/phpstan-phpunit": "^2.0",
57+
"phpstan/phpstan-symfony": "^2.0",
5458
"symfony/console": "^6.4 || ^7.0",
5559
"symfony/mailer": "^6.4 || ^7.0",
5660
"symfony/mime": "^6.4 || ^7.0",

phpstan.neon

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
parameters:
2+
level: 8
3+
inferPrivatePropertyTypeFromConstructor: true
4+
treatPhpDocTypesAsCertain: false
5+
paths:
6+
- src/
7+
- tests/
8+
ignoreErrors:
9+
- '~Method FOS\\UserBundle\\Tests\\[\w\\]+Test::test\w+\(\) has no return type specified.~'
10+
11+
includes:
12+
- vendor/phpstan/phpstan-phpunit/extension.neon
13+
- vendor/phpstan/phpstan-phpunit/rules.neon
14+
- vendor/phpstan/phpstan-symfony/extension.neon
15+
- vendor/phpstan/phpstan-symfony/rules.neon

0 commit comments

Comments
 (0)