Skip to content

Commit fdd4aaf

Browse files
committed
Upload phpstan report to code scanning results
1 parent a7aecf8 commit fdd4aaf

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

.github/workflows/coding-standards.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,13 @@ jobs:
108108
phpstan-result-cache-
109109
110110
- name: Run PHPStan
111-
run: ./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi
111+
run: ./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi --error-format=sarif > phpstan.sarif
112+
113+
- name: "Upload SARIF report"
114+
if: always()
115+
uses: "github/codeql-action/upload-sarif@v3"
116+
with:
117+
sarif_file: phpstan.sarif
112118

113119
- name: Save cache PHPStan results
114120
id: phpstan-cache-save

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"mockery/mockery": "^1.4.4",
4040
"doctrine/coding-standard": "12.0.x-dev",
4141
"spatie/laravel-query-builder": "^5.6",
42-
"phpstan/phpstan": "^1.10"
42+
"phpstan/phpstan": "1.11.x-dev",
43+
"jbelien/phpstan-sarif-formatter": "^1.0"
4344
},
4445
"suggest": {
4546
"mongodb/builder": "Provides a fluent aggregation builder for MongoDB pipelines"

phpstan.neon.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,11 @@ parameters:
1414
ignoreErrors:
1515
- '#Unsafe usage of new static#'
1616
- '#Call to an undefined method [a-zA-Z0-9\\_\<\>]+::[a-zA-Z]+\(\)#'
17+
18+
services:
19+
errorFormatter.sarif:
20+
class: PHPStanSarifErrorFormatter\SarifErrorFormatter
21+
arguments:
22+
relativePathHelper: @simpleRelativePathHelper
23+
currentWorkingDirectory: %currentWorkingDirectory%
24+
pretty: true

0 commit comments

Comments
 (0)