Skip to content

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)

License

Notifications You must be signed in to change notification settings

socheatsok78/laravel-psalm-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

📝 License

Licensed under the MIT License.

About

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)

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published