newsuk/nuk-wp-phpstan-config

PHPStan configuration for WordPress VIP plugins and themes

Installs: 3 452

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 15

Forks: 0

Open Issues: 3

Type:phpstan-extension

v0.1.0 2024-01-15 13:30 UTC

This package is auto-updated.

Last update: 2024-05-07 16:12:14 UTC


README

NUK WP PHPStan config

This library contains PHPStan configuration for NewsUK plugins and themes.

Installation

Composer install:

composer require --dev newsuk/nuk-wp-phpstan-config

Using the ruleset

Create a phpstan.neon.dist file in the root of your project and add the below config. Feel free to alter the paths based on your project requirements

parameters:
    level: max
    paths:
        # adjust the filename / directory name according to project needs.
        - plugin.php
        - includes/

Composer scripts

Add the following to scripts section in composer.json file and run composer phpstan

"phpstan": "phpstan analyse --memory-limit=2048M"

Add the following to generate baseline file for existing plugins and run composer phpstan-baseline

"phpstan-baseline": "phpstan analyse -b --allow-empty-baseline"