Skip to content

Commit

Permalink
Add a phpstan job in the CI setup
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Dec 21, 2024
1 parent 777f8df commit 9e85e72
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/phpstan.dist.neon export-ignore
/CHANGELOG.md export-ignore
/README.md export-ignore
/.github export-ignore
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,18 @@ jobs:
- name: Upload code coverage
continue-on-error: true
run: wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover

static_analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "8.3"
ini-file: development
- name: Install dependencies
run: composer update --ansi --no-progress
- name: Run phpstan
run: vendor/bin/phpstan analyse --ansi --no-progress
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor
composer.lock
/.phpunit.result.cache
/phpunit.neon
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"symfony/css-selector": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5.21 || ^9.5.10"
"phpunit/phpunit": "^8.5.21 || ^9.5.10",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 11 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
parameters:
level: 10
treatPhpDocTypesAsCertain: false
paths:
- ./src/
- ./tests/

includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon

0 comments on commit 9e85e72

Please sign in to comment.