Skip to content

Commit d5092d9

Browse files
committed
ci(deps-dev): Add strict rules for Larastan and update dependencies
- Added "canvural/larastan-strict-rules" version ^3.0 to require-dev - Added "larastan/larastan" version ^3.8 to require-dev - Ensures better type safety and code quality in the project
1 parent 6c8e2f1 commit d5092d9

4 files changed

Lines changed: 26 additions & 1 deletion

File tree

.github/workflows/phpstan.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,15 @@ jobs:
3737
- name: Run composer install
3838
run: composer install --no-interaction --ansi -v
3939

40+
- name: Run phpstan with sarif error format
41+
continue-on-error: true
42+
run: composer phpstan:analyse-error-format-sarif
43+
44+
- name: Upload the analysis results of sarif to GitHub
45+
uses: github/codeql-action/upload-sarif@v4
46+
with:
47+
sarif_file: .build/phpstan/results.sarif
48+
wait-for-processing: true
49+
4050
- name: Run phpstan
4151
run: composer phpstan:analyse

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"guanguans/php-cs-fixer-custom-fixers": "^1.0",
7272
"guanguans/rector-rules": "^1.0",
7373
"itsgoingd/clockwork": "^5.3",
74+
"jbelien/phpstan-sarif-formatter": "^1.2",
7475
"laradumps/laradumps": "^4.6",
7576
"laravel/facade-documenter": "dev-main",
7677
"laravel/telescope": "^5.16",
@@ -385,6 +386,10 @@
385386
"phpmnd": "@php vendor/bin/phpmnd src/ --exclude-path=Support/helpers.phpp --ignore-numbers=2,-1 --hint --progress --ansi -vv",
386387
"phpstan": "@php vendor/bin/phpstan --ansi -vv",
387388
"phpstan:analyse": "@phpstan analyse",
389+
"phpstan:analyse-error-format-sarif": [
390+
"[ -d .build/phpstan/ ] || mkdir -p .build/phpstan/",
391+
"@php vendor/bin/phpstan --ansi -vv analyse --error-format=sarif > .build/phpstan/results.sarif"
392+
],
388393
"phpstan:analyse-generate-baseline": "@phpstan:analyse --generate-baseline --allow-empty-baseline",
389394
"phpstan:analyse-split-baseline": [
390395
"@phpstan:analyse --generate-baseline=baselines/loader.neon --allow-empty-baseline",
@@ -471,7 +476,7 @@
471476
"var-dump-server:cli": "@php vendor/bin/var-dump-server --ansi -vv",
472477
"var-dump-server:html": [
473478
"@composer-config:disable-process-timeout",
474-
"[ -d .build ] || mkdir -p .build/",
479+
"[ -d .build/ ] || mkdir -p .build/",
475480
"[ -f .build/dump.html ] || touch .build/dump.html",
476481
"open .build/dump.html",
477482
"@php vendor/bin/var-dump-server --ansi -v --format=html > .build/dump.html"

phpstan.neon.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ includes:
2727
# - vendor/symplify/phpstan-rules/config/rector-rules.neon
2828
# - vendor/symplify/phpstan-rules/config/symfony-rules.neon
2929

30+
services:
31+
errorFormatter.sarif:
32+
class: PHPStanSarifErrorFormatter\SarifErrorFormatter
33+
arguments:
34+
relativePathHelper: @simpleRelativePathHelper
35+
currentWorkingDirectory: %currentWorkingDirectory%
36+
pretty: true
37+
3038
parameters:
3139
paths:
3240
- config/

vendor-bin/php82/composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"require-dev": {
33
"php": ">=8.2",
4+
"canvural/larastan-strict-rules": "^3.0",
45
"ergebnis/composer-normalize": "^2.48",
56
"guanguans/monorepo-builder-worker": "^2.1",
7+
"larastan/larastan": "^3.8",
68
"mrpunyapal/rector-pest": "^0.1",
79
"peckphp/peck": "^0.2",
810
"phpro/grumphp-shim": "^2.18",

0 commit comments

Comments
 (0)