Skip to content

Commit ff961f8

Browse files
committed
added phpstan config with baseline
1 parent 931eef1 commit ff961f8

File tree

8 files changed

+13825
-0
lines changed

8 files changed

+13825
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Static Analysis
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- .github/workflows/static-analysis.yml
9+
- tests/StaticAnalysis/*
10+
- composer.*
11+
- lib/**
12+
- phpstan*
13+
14+
push:
15+
branches:
16+
- master
17+
paths:
18+
- .github/workflows/static-analysis.yml
19+
- tests/StaticAnalysis/*
20+
- composer.*
21+
- lib/**
22+
- phpstan*
23+
24+
jobs:
25+
static-analysis-phpstan:
26+
name: Static Analysis with PHPStan
27+
runs-on: ubuntu-22.04
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Install PHP
34+
uses: shivammathur/setup-php@v2
35+
with:
36+
coverage: none
37+
php-version: 8.3
38+
tools: cs2pr
39+
40+
- name: Install dependencies with Composer
41+
uses: ramsey/composer-install@v2
42+
43+
- name: Run static analysis w/ phpVersion 74
44+
run: vendor/bin/phpstan analyse -c tests/StaticAnalysis/phpstan-74.neon --error-format=checkstyle | cs2pr
45+
46+
- name: Run static analysis w/ phpVersion 83
47+
run: vendor/bin/phpstan analyse -c tests/StaticAnalysis/phpstan-83.neon --error-format=checkstyle | cs2pr
48+

composer.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"ext-pdo": "*",
2727
"ext-zlib": "*"
2828
},
29+
"require-dev": {
30+
"phpstan/phpstan": "^1.10"
31+
},
2932
"support": {
3033
"issues": "https://github.com/FriendsOfSymfony1/doctrine1/issues",
3134
"source": "https://github.com/FriendsOfSymfony1/doctrine1"
@@ -42,5 +45,12 @@
4245
},
4346
"config": {
4447
"sort-packages": true
48+
},
49+
"scripts": {
50+
"analyse": [
51+
"@phpstan83"
52+
],
53+
"phpstan74": "phpstan analyse -c tests/StaticAnalysis/phpstan-74.neon --memory-limit=500M",
54+
"phpstan83": "phpstan analyse -c tests/StaticAnalysis/phpstan-83.neon --memory-limit=500M"
4555
}
4656
}

phpstan.dist.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
phpVersion: 80300
3+
4+
includes:
5+
- tests/StaticAnalysis/phpstan-params.neon
6+
- tests/StaticAnalysis/phpstan-baseline-83.php
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
phpVersion: 80300
3+
4+
includes:
5+
- phpstan-params.neon
6+
- phpstan-baseline-74.php
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
phpVersion: 80300
3+
4+
includes:
5+
- phpstan-params.neon
6+
- phpstan-baseline-83.php

0 commit comments

Comments
 (0)