Skip to content

Commit 311c824

Browse files
authored
Merge pull request #158 from PHPCSStandards/feature/add-phpstan
Add PHPStan to QA checks
2 parents 2dee3ea + dcea715 commit 311c824

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/.gitignore export-ignore
1010
/.github export-ignore
1111
/phpcs.xml.dist export-ignore
12+
/phpstan.neon.dist export-ignore
1213
/phpunit.xml.dist export-ignore
1314
/phpunit-bootstrap.php export-ignore
1415
/PHPCSDebug/Tests export-ignore

.github/workflows/cs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,30 @@ jobs:
9797
- name: Show PHPCS results in PR
9898
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
9999
run: cs2pr ./phpcs-report.xml
100+
101+
phpstan:
102+
name: "PHPStan"
103+
runs-on: "ubuntu-latest"
104+
105+
steps:
106+
- name: Checkout code
107+
uses: actions/checkout@v4
108+
109+
- name: Install PHP
110+
uses: shivammathur/setup-php@v2
111+
with:
112+
php-version: 'latest'
113+
coverage: none
114+
tools: phpstan
115+
116+
# Install dependencies and handle caching in one go.
117+
# Dependencies need to be installed to make sure the PHPCS and PHPUnit classes are recognized.
118+
# @link https://github.com/marketplace/actions/install-composer-dependencies
119+
- name: Install Composer dependencies
120+
uses: "ramsey/composer-install@v3"
121+
with:
122+
# Bust the cache at least once a month - output format: YYYY-MM.
123+
custom-cache-suffix: $(date -u "+%Y-%m")
124+
125+
- name: Run PHPStan
126+
run: phpstan analyse

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ composer.lock
55
phpcs.xml
66
phpunit.xml
77
.phpunit.result.cache
8+
phpstan.neon

phpstan.neon.dist

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
parameters:
2+
#phpVersion: 50400 # Needs to be 70100 or higher... sigh...
3+
level: 6
4+
paths:
5+
- bin
6+
- PHPCSDebug
7+
- Scripts
8+
- Tests
9+
bootstrapFiles:
10+
- phpunit-bootstrap.php
11+
treatPhpDocTypesAsCertain: false

0 commit comments

Comments
 (0)