Download the PHP package sidz/phpstan-rules without Composer
On this page you can find all versions of the php package sidz/phpstan-rules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sidz/phpstan-rules
More information about sidz/phpstan-rules
Files in sidz/phpstan-rules
Package phpstan-rules
Short Description Set of PHPStan rules
License MIT
Homepage https://github.com/sidz/phpstan-rules
Informations about the package phpstan-rules
phpstan-rules
Provides additional rules for phpstan/phpstan
.
Installation
Run
If you use PHPStan extension installer, you're all set. If not, you need to manually register all the rules in your phpstan.neon
:
Each rule by default ignores the following numbers: 0
and 1
. This can be configured by adding the following parameter to your phpstan.neon
:
Each rule by default detects numeric strings like '12'
in source code. This behavior could be disabled via parameter:
Ignoring particular rules
If you need to ignore particular rule, for example NoMagicNumberInComparisonOperatorRule
, you can do so by using built-in ignoreErrors
parameter:
If you need to ignore this rule only for particular file or folder, this also can be done by using ignoreErrors
parameter:
And finally, if you want to ignore all the rules from this package for particular files or folders, add this to phpstan.neon
:
Rules
This package provides the following rules for use with phpstan/phpstan
:
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberAsFunctionArgumentRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberAssignedToPropertyRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberInArithmeticOperatorRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberInBitwiseOperatorRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberInComparisonOperatorRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberInDefaultParameterRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberInLogicalOperatorRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberInMatchRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberInReturnStatementRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberInSwitchCaseRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberInTernaryOperatorRule
Sid\PHPStan\Rules\MagicNumber\NoMagicNumberVariableAssignmentRule
Classes
MagicNumber\NoMagicNumberAsFunctionArgumentRule
This rule reports an error when magic number is used as function argument:
MagicNumber\NoMagicNumberAssignedToPropertyRule
This rule reports an error when magic number is assigned to class property:
MagicNumber\NoMagicNumberInArithmeticOperatorRule
This rule reports an error when magic number is used in various arithmetic operators:
MagicNumber\NoMagicNumberInBitwiseOperatorRule
This rule reports an error when magic number is used in various bitwise operators:
MagicNumber\NoMagicNumberInComparisonOperatorRule
This rule reports an error when magic number is used in comparison operator:
MagicNumber\NoMagicNumberInDefaultParameterRule
This rule reports an error when magic number is used as default parameter:
MagicNumber\NoMagicNumberInLogicalOperatorRule
This rule reports an error when magic number is used as part of logical operation:
MagicNumber\NoMagicNumberInMatchRule
This rule reports an error when magic number is used in arms or conditions:
MagicNumber\NoMagicNumberInReturnStatementRule
This rule reports an error when magic number is used in return
statement:
MagicNumber\NoMagicNumberInSwitchCaseRule
This rule reports an error when magic number is used in condition or cases:
MagicNumber\NoMagicNumberInTernaryOperatorRule
This rule reports an error when magic number is used in ternary operator:
MagicNumber\NoMagicNumberVariableAssignmentRule
This rule reports an error when magic number is assigned to some variable:
License
This package is licensed using the MIT License.
Please have a look at LICENSE.md
.