Skip to content

PHPStan configuration for Craft CMS projects.

License

Notifications You must be signed in to change notification settings

craftcms/phpstan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPStan config for Craft CMS

This package provides a base PHPStan configuration for Craft CMS plugins and projects.

To install, run the following commands within your plugin or project:

composer config minimum-stability dev
composer config prefer-stable true
composer require craftcms/phpstan:dev-main --dev

Then add a phpstan.neon config file to the root of your project:

includes:
    - vendor/craftcms/phpstan/phpstan.neon

parameters:
    level: 0
    paths:
        - src

Change the paths array to whichever directory(s) contain the source code you want PHPStan to inspect.

(See PHPStan’s Config Reference for a full list of supported config parameters.)

With that in place, you can begin running PHPStan with the following command:

vendor/bin/phpstan --memory-limit=1G

Or define a phpstan script in composer.json:

{
  "...": "...",
  "scripts": {
    "phpstan": "phpstan --memory-limit=1G"
  }
}

And then run PHPStan with:

composer run-script phpstan

About

PHPStan configuration for Craft CMS projects.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks