Skip to content

Commit 961b06d

Browse files
committed
Added PHPStan
1 parent 3511d1f commit 961b06d

6 files changed

Lines changed: 439 additions & 2 deletions

File tree

.github/workflows/phpstan.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: PHPStan
2+
3+
env:
4+
COMPOSE_USER: runner
5+
6+
on:
7+
pull_request:
8+
paths: &paths
9+
- "**/*.php"
10+
- "phpstan.neon"
11+
- "phpstan.neon.dist"
12+
- "phpstan-baseline.neon"
13+
- "composer.json"
14+
- "composer.lock"
15+
- "docker-compose.yml"
16+
push:
17+
branches:
18+
- main
19+
- develop
20+
paths: *paths
21+
22+
jobs:
23+
phpstan:
24+
name: PHP - Static Analysis
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v6
28+
29+
- name: Create docker network
30+
run: |
31+
docker network create frontend
32+
33+
- run: |
34+
docker compose run --rm phpfpm composer install
35+
docker compose run --rm phpfpm vendor/bin/phpstan analyse --no-progress

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Cross-cutting entity foundation for Symfony 7.4 / 8.0 and Doctrine ORM 3 project
77
- PHP **>= 8.4**
88
- Symfony **7.4 or 8.0** (`framework-bundle`, `security-bundle`, `clock`, `finder`, `uid`)
99
- Doctrine ORM **^3.0** with `doctrine/doctrine-bundle` **^2.13 or ^3.0**
10-
- [`damienharper/auditor-bundle`](https://github.com/DamienHarper/auditor-bundle) **^6.3** (only relevant when `audit.enabled` is on)
10+
- [`damienharper/auditor-bundle`](https://github.com/DamienHarper/auditor-bundle) **^6.3**
11+
(only relevant when `audit.enabled` is on)
1112

1213
## Installation
1314

Taskfile.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ tasks:
4545
- '{{.COMPOSE_POSTGRES_PHP85}} run --rm phpfpm vendor/bin/phpunit {{.CLI_ARGS}}'
4646

4747
lint:
48-
desc: Run every CI lint check (php, composer, markdown, yaml)
48+
desc: Run every CI lint check (php, phpstan, composer, markdown, yaml)
4949
cmds:
5050
- task: lint:php
51+
- task: lint:phpstan
5152
- task: lint:composer
5253
- task: lint:markdown
5354
- task: lint:yaml
@@ -57,6 +58,11 @@ tasks:
5758
cmds:
5859
- '{{.COMPOSE}} run --rm phpfpm vendor/bin/php-cs-fixer fix --dry-run --diff'
5960

61+
lint:phpstan:
62+
desc: Static analysis (phpstan, level 8)
63+
cmds:
64+
- '{{.COMPOSE}} run --rm phpfpm vendor/bin/phpstan analyse --no-progress'
65+
6066
lint:composer:
6167
desc: Validate, normalize-check, and audit composer
6268
cmds:

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
"require-dev": {
1818
"ergebnis/composer-normalize": "^2.52",
1919
"friendsofphp/php-cs-fixer": "^3.95",
20+
"phpstan/extension-installer": "^1.4",
21+
"phpstan/phpstan": "^2.2",
22+
"phpstan/phpstan-doctrine": "^2.0",
23+
"phpstan/phpstan-phpunit": "^2.0",
24+
"phpstan/phpstan-symfony": "^2.0",
2025
"phpunit/phpunit": "^13.1",
2126
"symfony/browser-kit": "^7.4 || ^8.0",
2227
"symfony/dotenv": "^7.4 || ^8.0",
@@ -36,6 +41,7 @@
3641
"config": {
3742
"allow-plugins": {
3843
"ergebnis/composer-normalize": true,
44+
"phpstan/extension-installer": true,
3945
"symfony/flex": true,
4046
"symfony/runtime": true
4147
},

0 commit comments

Comments
 (0)