thecodingmachine/phpstan-strict-rules

A set of additional rules for PHPStan based on best practices followed at TheCodingMachine

Installs: 769 677

Dependents: 151

Suggesters: 0

Security: 0

Stars: 234

Watchers: 18

Forks: 13

Open Issues: 8

Type:phpstan-extension

v0.12.1 2020-09-08 09:14 UTC

README

Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality Build Status Coverage Status

TheCodingMachine's additional rules for PHPStan

This package contains a set of rules to be added to the wonderful PHPStan static analyzer.

Those rules come from TheCodingMachine best practices. They are more "strict" than the default PHPStan rules and some may be controversial. We use those at TheCodingMachine, have found them to help us in our daily work, and ask anyone working with us to follow them.

Rules list

Exception related rules

Superglobal related rules

Condition related rules

Work-in-progress

// Never use public properties
// Never use globals

Installation

We assume that PHPStan is already installed in your project.

To use this extension, require it in Composer:

composer require --dev thecodingmachine/phpstan-strict-rules

If you also install phpstan/extension-installer then you're all set!

Manual installation

If you don't want to use phpstan/extension-installer, include phpstan-strict-rules.neon in your project's PHPStan config:

includes:
    - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon