Skip to content

Commit ffe3870

Browse files
authored
Merge pull request #512 from wayofdev/feat/tpl-updates
feat: support for new tools
2 parents e614fa0 + f623e28 commit ffe3870

11 files changed

+1198
-105
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ package.json export-ignore
2020
phpstan.neon.dist export-ignore
2121
phpstan-baseline.neon export-ignore
2222
phpunit.xml.dist export-ignore
23+
psalm.xml export-ignore
24+
psalm-baseline.xml export-ignore
2325
renovate.json export-ignore
2426
rector.php export-ignore
2527
renovate.json export-ignore

.github/CONTRIBUTING.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,29 +230,34 @@ to run mutation tests.
230230

231231
## ⚙️ Static Code Analysis
232232

233-
We use [`phpstan/phpstan`](https://github.com/phpstan/phpstan) to statically analyze the code.
233+
We use both [`phpstan/phpstan`](https://github.com/phpstan/phpstan) and [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code.
234234

235235
Run
236236

237237
```sh
238238
$ make lint-stan
239+
$ make lint-psalm
239240
```
240241

241242
to run a static code analysis.
242243

243-
We also use the baseline features of [`phpstan/phpstan`](https://phpstan.org/user-guide/baseline).
244+
We also use the baseline features of [`phpstan/phpstan`](https://phpstan.org/user-guide/baseline) and [`vimeo/psalm`](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file) to ignore existing issues.
244245

245246
Run
246247

247248
```sh
248249
$ make lint-stan-baseline
250+
$ make lint-psalm-baseline
249251
```
250252

251-
to regenerate the baselines in [`../phpstan-baseline.neon`](../phpstan-baseline.neon).
253+
to regenerate the baselines in:
254+
255+
- [`../phpstan-baseline.neon`](../phpstan-baseline.neon).
256+
- [`../psalm-baseline.xml`](../psalm-baseline.xml).
252257

253258
> [!IMPORTANT]
254259
>
255-
> Ideally, the baseline file should stay empty or shrink over time.
260+
> Ideally, the baseline files should stay empty or shrink over time.
256261
257262
<br>
258263

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ contact_links:
1111
url: https://discord.gg/CE3TcCC5vr
1212
about: Join our Discord community to get help, share your ideas, and chat with other developers.
1313

14-
- name: Send an e-mail to the developer
15-
url: mailto:the@wayof.dev
16-
about: Please do NOT use this email to post issues or feature requests (only important business/personal contact).
14+
...

.github/workflows/integrate.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ jobs:
261261

262262
- name: 🧪 Run mutation testing using Xdebug and infection/infection
263263
run: composer infect:ci
264+
env:
265+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
264266

265267
security-analysis:
266268
timeout-minutes: 4

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,18 @@ lint-stan-baseline: ## Runs phpstan to update its baseline
208208
$(APP_COMPOSER) stan:baseline
209209
.PHONY: lint-stan-baseline
210210

211+
lint-psalm: ## Runs vimeo/psalm – static analysis tool
212+
$(APP_COMPOSER) psalm
213+
.PHONY: lint-psalm
214+
215+
lint-psalm-ci: ## Runs vimeo/psalm – static analysis tool with github output (CI mode)
216+
$(APP_COMPOSER) psalm:ci
217+
.PHONY: lint-psalm-ci
218+
219+
lint-psalm-baseline: ## Runs vimeo/psalm to update its baseline
220+
$(APP_COMPOSER) psalm:baseline
221+
.PHONY: lint-psalm-baseline
222+
211223
lint-deps: ## Runs composer-require-checker – checks for dependencies that are not used
212224
$(APP_RUNNER) .phive/composer-require-checker check \
213225
--config-file=/app/composer-require-checker.json \

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ This template repository includes several features to streamline the development
5050
- [Orchestra Testbench](https://packages.tools/testbench.html) for Laravel package testing.
5151
- [PHPStan](https://phpstan.org) extensions for PHPUnit and Laravel.
5252
- Infection for mutation testing to ensure quality.
53+
- Mutation test reports are uploaded [Stryker Mutator Dashboard](https://dashboard.stryker-mutator.io).
5354

5455
### → Static Analysis
5556

5657
- [PHPStan](https://phpstan.org) for static analysis, ensuring code quality and robustness.
5758
- [Larastan](https://github.com/larastan/larastan) for Laravel-specific static analysis.
5859
- [PHPStan strict rules](https://github.com/phpstan/phpstan-strict-rules) for enforcing strict type checks and standards.
60+
- [Psalm](https://psalm.dev) for finding errors in PHP applications through static analysis.
5961

6062
### → Coding Standards:
6163

@@ -67,9 +69,9 @@ This template repository includes several features to streamline the development
6769
- Automated testing with code coverage report generation using PHPUnit and Xdebug, uploaded to [Codecov](https://about.codecov.io).
6870
- Automated linting of YAML files and PHP code to ensure consistency and adherence to best practices.
6971
- Checks for outdated or insecure dependencies using Composer.
70-
- Mutation testing with [Infection](https://github.com/infection/infection) to assess the quality of the test suite.
72+
- Mutation testing with [Infection](https://github.com/infection/infection) and [Stryker Mutator](https://stryker-mutator.io) to assess the quality of the test suite.
7173
- Security checks to identify vulnerabilities in dependencies.
72-
- Comprehensive static analysis with [PHPStan](https://phpstan.org) to detect potential issues early.
74+
- Comprehensive static analysis with [PHPStan](https://phpstan.org) and [Psalm](https://psalm.dev).
7375
- Extensive testing across different setups to ensure compatibility and stability.
7476

7577
### → Development Environment

composer.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"ergebnis/composer-normalize": "^2.42",
2525
"ergebnis/phpunit-slow-test-detector": "^2.14",
2626
"fakerphp/faker": "^1.23",
27-
"infection/infection": "^0.28.1",
2827
"larastan/larastan": "^2.9",
2928
"orchestra/testbench": "^8.5 || ^9.0",
3029
"pestphp/pest": "^2.34",
@@ -35,8 +34,12 @@
3534
"phpstan/phpstan-phpunit": "^1.3",
3635
"phpstan/phpstan-strict-rules": "^1.5",
3736
"phpunit/phpunit": "^10.5 || ^11.0",
37+
"psalm/plugin-laravel": "^2.11",
38+
"psalm/plugin-phpunit": "~0.19.0",
3839
"rector/rector": "^1.0",
40+
"roave/infection-static-analysis-plugin": "^1.35",
3941
"roave/security-advisories": "dev-latest",
42+
"vimeo/psalm": "^5.23.1",
4043
"wayofdev/cs-fixer-config": "^1.2"
4144
},
4245
"minimum-stability": "dev",
@@ -83,13 +86,16 @@
8386
"scripts": {
8487
"cs:diff": "php vendor/bin/php-cs-fixer fix --dry-run -v --diff",
8588
"cs:fix": "php vendor/bin/php-cs-fixer fix -v",
86-
"infect": "XDEBUG_MODE=coverage php vendor/bin/infection --configuration=infection.json.dist",
87-
"infect:ci": "XDEBUG_MODE=coverage php vendor/bin/infection --ansi --configuration=infection.json.dist --logger-github",
89+
"infect": "XDEBUG_MODE=coverage php vendor/bin/roave-infection-static-analysis-plugin --configuration=infection.json.dist",
90+
"infect:ci": "XDEBUG_MODE=coverage php vendor/bin/roave-infection-static-analysis-plugin --ansi --configuration=infection.json.dist --logger-github --ignore-msi-with-no-mutations --only-covered",
8891
"refactor": "php vendor/bin/rector process --config=rector.php",
8992
"refactor:ci": "php vendor/bin/rector process --config=rector.php --dry-run --ansi",
9093
"stan": "php vendor/bin/phpstan analyse --memory-limit=2G",
9194
"stan:baseline": "php vendor/bin/phpstan analyse --generate-baseline --memory-limit=2G --allow-empty-baseline",
9295
"stan:ci": "php vendor/bin/phpstan analyse --memory-limit=2G --error-format=github",
96+
"psalm": "php vendor/bin/psalm --show-info=true",
97+
"psalm:baseline": "php vendor/bin/psalm --set-baseline=psalm-baseline.xml",
98+
"psalm:ci": "php vendor/bin/psalm --output-format=github --shepherd --show-info=false --stats --threads=4",
9399
"test": "XDEBUG_MODE=coverage php vendor/bin/pest",
94100
"test:cc": "XDEBUG_MODE=coverage php vendor/bin/pest --coverage --coverage-clover=.build/phpunit/logs/clover.xml"
95101
}

0 commit comments

Comments
 (0)