A zero-config installer for Psalm (a static analysis tool that’s designed to improve large PHP codebases by identifying both obvious and hard-to-spot bugs)
composer require --dev socheatsok78/laravel-psalm-helper
Add the following script to composer.json
:
"scripts": {
"psalm": [
"vendor/bin/psalm --show-info=false"
],
"psalm:info": [
"vendor/bin/psalm --show-info=true"
],
"psalm:dry-run": [
"vendor/bin/psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType --dry-run"
],
"psalm:alter": [
"vendor/bin/psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType"
]
}
Then later you can just run composer run psalm
Add a psalm.xml
config:
./vendor/bin/psalm --init [source_directory=src] [config_level=3]
where config_level
represents how strict you want Psalm to be. 1
is the strictest, 8
is the most lenient.
Example:
$ ./vendor/bin/psalm --init
Config file created successfully. Please re-run psalm.
$ ./vendor/bin/psalm-plugin enable psalm/plugin-laravel
[OK] Plugin enabled
Then run Psalm:
./vendor/bin/psalm
See more at Psalm Documentation
This package will only install the following dependencies:
Licensed under the MIT License.