Skip to content

Commit

Permalink
added phpstan config with baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhu committed Feb 29, 2024
1 parent 931eef1 commit ff961f8
Show file tree
Hide file tree
Showing 8 changed files with 13,825 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Static Analysis

on:
pull_request:
branches:
- master
paths:
- .github/workflows/static-analysis.yml
- tests/StaticAnalysis/*
- composer.*
- lib/**
- phpstan*

push:
branches:
- master
paths:
- .github/workflows/static-analysis.yml
- tests/StaticAnalysis/*
- composer.*
- lib/**
- phpstan*

jobs:
static-analysis-phpstan:
name: Static Analysis with PHPStan
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: 8.3
tools: cs2pr

- name: Install dependencies with Composer
uses: ramsey/composer-install@v2

- name: Run static analysis w/ phpVersion 74
run: vendor/bin/phpstan analyse -c tests/StaticAnalysis/phpstan-74.neon --error-format=checkstyle | cs2pr

- name: Run static analysis w/ phpVersion 83
run: vendor/bin/phpstan analyse -c tests/StaticAnalysis/phpstan-83.neon --error-format=checkstyle | cs2pr

10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"ext-pdo": "*",
"ext-zlib": "*"
},
"require-dev": {
"phpstan/phpstan": "^1.10"
},
"support": {
"issues": "https://github.com/FriendsOfSymfony1/doctrine1/issues",
"source": "https://github.com/FriendsOfSymfony1/doctrine1"
Expand All @@ -42,5 +45,12 @@
},
"config": {
"sort-packages": true
},
"scripts": {
"analyse": [
"@phpstan83"
],
"phpstan74": "phpstan analyse -c tests/StaticAnalysis/phpstan-74.neon --memory-limit=500M",
"phpstan83": "phpstan analyse -c tests/StaticAnalysis/phpstan-83.neon --memory-limit=500M"
}
}
6 changes: 6 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
phpVersion: 80300

includes:
- tests/StaticAnalysis/phpstan-params.neon
- tests/StaticAnalysis/phpstan-baseline-83.php
6 changes: 6 additions & 0 deletions tests/StaticAnalysis/phpstan-74.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
phpVersion: 80300

includes:
- phpstan-params.neon
- phpstan-baseline-74.php
6 changes: 6 additions & 0 deletions tests/StaticAnalysis/phpstan-83.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
phpVersion: 80300

includes:
- phpstan-params.neon
- phpstan-baseline-83.php
Loading

0 comments on commit ff961f8

Please sign in to comment.