Add PHPStan for static analysis (#905)

This commit is contained in:
Zach Borboa
2025-01-10 17:47:54 -05:00
committed by GitHub
parent a11ecf6d7b
commit ffda7c386a
4 changed files with 35 additions and 2 deletions
+6 -2
View File
@@ -46,8 +46,12 @@ jobs:
CI_PHP_VERSION: ${{ matrix.php-version }}
CI_PHP_FUTURE_RELEASE: ${{ matrix.future-release }}
- name: Static analysis
- name: Static analysis - Psalm
run: 'vendor/bin/psalm --config="tests/psalm.xml"'
# TODO: Remove exclusion that skips running psalm on PHP 8.4 when psalm
# supports PHP 8.4 (https://github.com/vimeo/psalm/issues/11107).
if: ${{ !matrix.future-release && matrix.php-version < 8.4 }}
if: ${{ matrix.php-version < 8.4 }}
- name: Static analysis - PHPStan
run: 'vendor/bin/phpstan analyse --configuration="phpstan.neon" .'
if: ${{ matrix.php-version >= 7.4 }}
+1
View File
@@ -27,6 +27,7 @@
"friendsofphp/php-cs-fixer": "*",
"phpcompatibility/php-compatibility": "dev-develop",
"phpcsstandards/phpcsutils": "@alpha",
"phpstan/phpstan": "*",
"phpunit/phpunit": "*",
"squizlabs/php_codesniffer": "*"
},
+13
View File
@@ -0,0 +1,13 @@
parameters:
ignoreErrors:
-
message: '#^Class CurlHandle not found\.$#'
identifier: class.notFound
count: 2
path: src/Curl/Curl.php
-
message: '#^Class CurlMultiHandle not found\.$#'
identifier: class.notFound
count: 2
path: src/Curl/MultiCurl.php
+15
View File
@@ -0,0 +1,15 @@
includes:
- phpstan-baseline.neon
parameters:
reportUnmatchedIgnoredErrors: false
# TODO: Increase rule level to be more strict.
level: 0
# TODO: Remove all exclusions except vendor/ and fix related errors.
excludePaths:
- examples/*
- tests/*
- vendor/*
- www/*