socheatsok78/laravel-psalm-helper

Laravel Psalm Helper

Downloads

16

Stars

0

Version

v1.0.1

Laravel Psalm Helper

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)

Required: PHP7.2 packagis packagis-download License

Installaion

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

Usage

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

What's inside?

This package will only install the following dependencies:

:memo: License

Licensed under the MIT License.

socheatsok78

Author

socheatsok78