Skip to content

Collection of useful additional phpstan rules. Currently only one rule, which checks immutability of objects (e.g. value objects) or properties.

License

Notifications You must be signed in to change notification settings

svnldwg/phpstan-rules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpstan-rules

Provides additional rules for phpstan/phpstan.

This package is still in development, please report any issues or bugs.

CI Status GitHub last commit PHPStan PHP Versions Downloads

Installation

Run

$ composer require --dev svnldwg/phpstan-rules

Usage

The rules provided are included in rules.neon.

When you are using phpstan/extension-installer, rules.neon will be automatically included.

Otherwise you need to include rules.neon in your phpstan.neon:

includes:
	- vendor/svnldwg/phpstan-rules/rules.neon

Rules

This package provides the following rules for use with phpstan/phpstan:

ImmutableObjectRule

This rule reports an error when a class or class property tagged as immutable is mutable. This can be used for example to ensure that value objects are always immutable.

💡 Classes or properties can be tagged as immutable by adding the annotation @psalm-immutable or @immutable to the phpdoc.

💡 The immutability rule also asserts that immutable properties are not mutated in child classes

License

This package is licensed using the MIT License.

Please have a look at LICENSE.md.

About

Collection of useful additional phpstan rules. Currently only one rule, which checks immutability of objects (e.g. value objects) or properties.

Resources

License

Stars

Watchers

Forks

Packages

No packages published