Skip to content

Commit

Permalink
Enhancement: Switch from vimeo/psalm to phpstan/phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Jan 7, 2025
1 parent 0d951bd commit bf798f8
Show file tree
Hide file tree
Showing 12 changed files with 371 additions and 996 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ indent_size = 2
[*.md]
indent_size = 2

[*.neon]
indent_style = tab

[*.{yaml,yml}]
indent_size = 2

Expand Down
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
/composer.lock export-ignore
/infection.json export-ignore
/Makefile export-ignore
/psalm-baseline.xml export-ignore
/psalm.xml export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.neon export-ignore
/rector.php export-ignore
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ to run a security analysis.

## Static Code Analysis

We use [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code.
We use [`phpstan/phpstan`](https://github.com/phpstan/phpstan) to statically analyze the code.

Run

Expand All @@ -94,15 +94,15 @@ make static-code-analysis

to run a static code analysis.

We also use the baseline feature of [`vimeo/psalm`](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file).
We also use the baseline feature of [`phpstan/phpstan`](https://phpstan.org/user-guide/baseline).

Run

```sh
make static-code-analysis-baseline
```

to regenerate the baseline in [`../psalm-baseline.xml`](../psalm-baseline.xml).
to regenerate the baseline in [`../phpstan-baseline.neon`](../phpstan-baseline.neon).

:exclamation: Ideally, the baseline should shrink over time.

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ jobs:
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Run vimeo/psalm"
run: "vendor/bin/psalm --config=psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4"
- name: "Run phpstan/phpstan"
run: "vendor/bin/phpstan --ansi --configuration=phpstan.neon --memory-limit=-1"

tests:
name: "Tests"
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ security-analysis: vendor ## Runs a security analysis with composer
composer audit

.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with vimeo/psalm
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --show-info=false --stats --threads=4
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan
vendor/bin/phpstan clear-result-cache --configuration=phpstan.neon
vendor/bin/phpstan --configuration=phpstan.neon --memory-limit=-1

.PHONY: static-code-analysis-baseline
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with vimeo/psalm
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan
vendor/bin/phpstan clear-result-cache --configuration=phpstan.neon
vendor/bin/phpstan --allow-empty-baseline --configuration=phpstan.neon --generate-baseline=phpstan-baseline.neon --memory-limit=-1

.PHONY: tests
tests: vendor ## Runs unit tests with phpunit/phpunit
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
[![Renew](https://github.com/ergebnis/classy/workflows/Renew/badge.svg)](https://github.com/ergebnis/classy/actions)

[![Code Coverage](https://codecov.io/gh/ergebnis/classy/branch/main/graph/badge.svg)](https://codecov.io/gh/ergebnis/classy)
[![Type Coverage](https://shepherd.dev/github/ergebnis/classy/coverage.svg)](https://shepherd.dev/github/ergebnis/classy)

[![Latest Stable Version](https://poser.pugx.org/ergebnis/classy/v/stable)](https://packagist.org/packages/ergebnis/classy)
[![Total Downloads](https://poser.pugx.org/ergebnis/classy/downloads)](https://packagist.org/packages/ergebnis/classy)
Expand Down
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@
"ergebnis/phpunit-slow-test-detector": "^2.17.0",
"fakerphp/faker": "^1.24.1",
"infection/infection": "~0.26.6",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^2.1.1",
"phpstan/phpstan-deprecation-rules": "^2.0.1",
"phpstan/phpstan-phpunit": "^2.0.3",
"phpstan/phpstan-strict-rules": "^2.0.1",
"phpunit/phpunit": "^9.6.19",
"psalm/plugin-phpunit": "~0.19.0",
"rector/rector": "^2.0.6",
"vimeo/psalm": "^5.26.1"
"rector/rector": "^2.0.6"
},
"autoload": {
"psr-4": {
Expand All @@ -56,7 +59,8 @@
"allow-plugins": {
"composer/package-versions-deprecated": true,
"ergebnis/composer-normalize": true,
"infection/extension-installer": true
"infection/extension-installer": true,
"phpstan/extension-installer": true
},
"audit": {
"abandoned": "report"
Expand Down
Loading

0 comments on commit bf798f8

Please sign in to comment.