Skip to content

Commit 6eae19e

Browse files
authored
Merge pull request #19 from itk-dev/feature/4268-api-platform-v4-phpstan
4268: Replaced Psaml with PHPStan
2 parents 5be4382 + 6df3792 commit 6eae19e

19 files changed

+288
-864
lines changed

.github/workflows/pr.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ jobs:
4848
- name: Check that nothing has changed
4949
run: git diff --exit-code
5050

51-
psalm:
51+
code-analysis-phpstan:
5252
runs-on: ubuntu-latest
53-
name: Psalm static analysis
53+
name: PHPStan static analysis
5454
steps:
5555
- uses: actions/checkout@v4
5656

@@ -63,7 +63,7 @@ jobs:
6363
6464
- name: Run code analysis
6565
run: |
66-
task --yes code-analysis:psalm
66+
task --yes code-analysis:phpstan
6767
6868
apispec:
6969
runs-on: ubuntu-latest

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@
2828
###< vincentlanglet/twig-cs-fixer ###
2929

3030
.phpunit.cache
31+
32+
###> phpstan/phpstan ###
33+
phpstan.neon
34+
###< phpstan/phpstan ###

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ See [keep a changelog] for information about writing changes to this log.
1313
- Added simple API tests and resolved some deprecations
1414
- Upgraded to API platform v4
1515
- Updated composer packages (security update) and recipes
16+
- Replaces [Psalm](https://psalm.dev/) with [PHPStan](https://phpstan.org/) (via
17+
<https://github.com/phpstan/phpstan-symfony>).
1618

1719
## [1.1.1] - 2025-03-28
1820

Taskfile.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ vars:
1010
DOCKER_COMPOSE: '{{.TASK_DOCKER_COMPOSE | default "docker compose"}}'
1111

1212
# We're not yet ready to normalize config files …
13-
YAML_FILES_GLOB: "Taskfile.yml .github/workflows/**.{yml,yaml}"
13+
YAML_FILES_GLOB: "Taskfile.yml .github/workflows/**.{yml,yaml} phpstan.dist.neon"
1414

1515
tasks:
1616
site:update:
@@ -163,7 +163,7 @@ tasks:
163163
cmds:
164164
- task: compose
165165
vars:
166-
COMPOSE_ARGS: run --rm prettier {{.YAML_FILES_GLOB}} --write
166+
COMPOSE_ARGS: run --rm prettier --parser yaml {{.YAML_FILES_GLOB}} --write
167167
silent: true
168168

169169
coding-standards:yaml:check:
@@ -172,15 +172,21 @@ tasks:
172172
- task: coding-standards:yaml:apply
173173
- task: compose
174174
vars:
175-
COMPOSE_ARGS: run --rm prettier {{.YAML_FILES_GLOB}} --check
175+
COMPOSE_ARGS: run --rm prettier --parser yaml {{.YAML_FILES_GLOB}} --check
176176
silent: true
177177

178-
code-analysis:psalm:
179-
desc: "Run PSalm"
178+
code-analysis:
179+
desc: "Run code analysis"
180+
cmds:
181+
- task: code-analysis:phpstan
182+
silent: true
183+
184+
code-analysis:phpstan:
185+
desc: "Run PHPStan"
180186
cmds:
181187
- task: compose
182188
vars:
183-
COMPOSE_ARGS: exec phpfpm vendor/bin/psalm --no-cache
189+
COMPOSE_ARGS: exec phpfpm vendor/bin/phpstan
184190
silent: true
185191

186192
apispec:export:

composer.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@
3131
"require-dev": {
3232
"ergebnis/composer-normalize": "^2.47",
3333
"friendsofphp/php-cs-fixer": "^3.40",
34+
"phpstan/extension-installer": "^1.4",
35+
"phpstan/phpstan-symfony": "^2.0",
3436
"phpunit/phpunit": "^10.5",
35-
"psalm/plugin-symfony": "^5.1",
3637
"symfony/browser-kit": "~6.4.0",
3738
"symfony/maker-bundle": "^1.52",
3839
"symfony/phpunit-bridge": "^7.3",
3940
"symfony/stopwatch": "~6.4.0",
4041
"symfony/web-profiler-bundle": "~6.4.0",
41-
"vimeo/psalm": "^5.16",
42-
"vincentlanglet/twig-cs-fixer": "^3.7",
43-
"weirdan/doctrine-psalm-plugin": "^2.9"
42+
"vincentlanglet/twig-cs-fixer": "^3.7"
4443
},
4544
"replace": {
4645
"symfony/polyfill-ctype": "*",
@@ -70,14 +69,15 @@
7069
"allow-plugins": {
7170
"ergebnis/composer-normalize": true,
7271
"php-http/discovery": true,
72+
"phpstan/extension-installer": true,
7373
"symfony/flex": true,
7474
"symfony/runtime": true
7575
},
7676
"sort-packages": true
7777
},
7878
"extra": {
7979
"symfony": {
80-
"allow-contrib": false,
80+
"allow-contrib": true,
8181
"require": "6.4.*"
8282
}
8383
},
@@ -100,9 +100,6 @@
100100
],
101101
"coding-standards-check": [
102102
"PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run"
103-
],
104-
"psalm": [
105-
"./vendor/bin/psalm --no-cache"
106103
]
107104
}
108105
}

0 commit comments

Comments
 (0)