Skip to content

Commit

Permalink
Add phpstan configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan committed Jul 28, 2024
1 parent f03f3ad commit 54e8007
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/vendor/
/.php-cs-fixer.php
/composer.lock
/phpstan.neon
18 changes: 16 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@
"require": {
"php": "^8.2"
},
"require-dev": {
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-strict-rules": "^1.6"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
},
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
Expand All @@ -31,10 +41,14 @@
"@composer update --ansi --working-dir=tools"
],
"cs:check": "tools/vendor/bin/php-cs-fixer check --ansi --verbose --diff",
"cs:fix": "tools/vendor/bin/php-cs-fixer fix --ansi --verbose --diff"
"cs:fix": "tools/vendor/bin/php-cs-fixer fix --ansi --verbose --diff",
"phpstan:baseline": "phpstan analyse --ansi --generate-baseline=phpstan-baseline.php",
"phpstan:check": "phpstan analyse --ansi --verbose"
},
"scripts-descriptions": {
"cs:check": "Checks for coding style violations",
"cs:fix": "Fixes any coding style violations"
"cs:fix": "Fixes any coding style violations",
"phpstan:baseline": "Runs PHPStans and dumps resulting errors to baseline",
"phpstan:check": "Runs PHPStan with identifiers support"
}
}
28 changes: 28 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon

parameters:
phpVersion: 80200
level: 8
tmpDir: build/phpstan
paths:
- src
- tests
- tools
excludePaths:
analyseAndScan:
- tools/vendor/**
bootstrapFiles:
- vendor/autoload.php
exceptions:
check:
missingCheckedExceptionInThrows: true
tooWideThrowType: true
checkTooWideReturnTypesInProtectedAndPublicMethods: true
checkUninitializedProperties: true
checkBenevolentUnionTypes: true
reportPossiblyNonexistentGeneralArrayOffset: true
reportPossiblyNonexistentConstantArrayOffset: true
reportAlwaysTrueInLastCondition: true
reportAnyTypeWideningInVarTag: true
checkMissingCallableSignature: true

0 comments on commit 54e8007

Please sign in to comment.