socheatsok78/laravel-psalm-helper

Laravel Psalm Helper

Fund package maintenance!
socheatsok78

Installs: 17

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 1

Type:metapackage

v1.0.1 2019-12-26 01:56 UTC

This package is auto-updated.

Last update: 2024-11-29 06:03:36 UTC


README

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:

📝 License

Licensed under the MIT License.