Download the PHP package ergebnis/phpstan-rules without Composer
On this page you can find all versions of the php package ergebnis/phpstan-rules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ergebnis/phpstan-rules
More information about ergebnis/phpstan-rules
Files in ergebnis/phpstan-rules
Package phpstan-rules
Short Description Provides rules for phpstan/phpstan.
License MIT
Homepage https://github.com/ergebnis/phpstan-rules
Informations about the package phpstan-rules
phpstan-rules
This project provides a composer
package with rules for phpstan/phpstan
.
Installation
Run
Usage
All of the rules provided (and used) by this library 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
:
:bulb: You probably want to use these rules on top of the rules provided by:
Rules
This package provides the following rules for use with phpstan/phpstan
:
Ergebnis\PHPStan\Rules\Classes\FinalRule
Ergebnis\PHPStan\Rules\Classes\NoExtendsRule
Ergebnis\PHPStan\Rules\Classes\PHPUnit\Framework\TestCaseWithSuffixRule
Ergebnis\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule
Ergebnis\PHPStan\Rules\Closures\NoParameterWithNullableTypeDeclarationRule
Ergebnis\PHPStan\Rules\Closures\NoParameterWithNullDefaultValueRule
Ergebnis\PHPStan\Rules\Expressions\NoCompactRule
Ergebnis\PHPStan\Rules\Expressions\NoErrorSuppressionRule
Ergebnis\PHPStan\Rules\Expressions\NoEvalRule
Ergebnis\PHPStan\Rules\Expressions\NoIssetRule
Ergebnis\PHPStan\Rules\Files\DeclareStrictTypesRule
Ergebnis\PHPStan\Rules\Functions\NoNullableReturnTypeDeclarationRule
Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullableTypeDeclaration
Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullDefaultValueRule
Ergebnis\PHPStan\Rules\Methods\FinalInAbstractClassRule
Ergebnis\PHPStan\Rules\Methods\NoConstructorParameterWithDefaultValueRule
Ergebnis\PHPStan\Rules\Methods\NoNullableReturnTypeDeclarationRule
Ergebnis\PHPStan\Rules\Methods\NoParameterWithContainerTypeDeclarationRule
Ergebnis\PHPStan\Rules\Methods\NoParameterWithNullableTypeDeclarationRule
Ergebnis\PHPStan\Rules\Methods\NoParameterWithNullDefaultValueRule
Ergebnis\PHPStan\Rules\Methods\PrivateInFinalClassRule
Ergebnis\PHPStan\Rules\Statements\NoSwitchRule
Classes
Classes\FinalRule
This rule reports an error when a non-anonymous class is not final
.
:bulb: This rule ignores classes that
- use
@Entity
,@ORM\Entity
, or@ORM\Mapping\Entity
annotations - use
Doctrine\ORM\Mapping\Entity
attributes
on the class level.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Disallowing abstract
classes
By default, this rule allows to declare abstract
classes.
You can set the allowAbstractClasses
parameter to false
to disallow abstract classes.
Excluding classes from inspection
You can set the classesNotRequiredToBeAbstractOrFinal
parameter to a list of class names that you want to exclude from inspection.
Classes\NoExtendsRule
This rule reports an error when a class extends another class.
Defaults
By default, this rule allows the following classes to be extended:
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Allowing classes to be extended
You can set the classesAllowedToBeExtended
parameter to a list of class names that you want to allow to be extended.
Classes\PHPUnit\Framework\TestCaseWithSuffixRule
This rule reports an error when a concrete class is a sub-class of PHPUnit\Framework\TestCase
but does not have a Test
suffix.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Closures
Closures\NoNullableReturnTypeDeclarationRule
This rule reports an error when a closure uses a nullable return type declaration.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Closures\NoParameterWithNullableTypeDeclarationRule
This rule reports an error when a closure has a parameter with a nullable type declaration.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Closures\NoParameterWithNullDefaultValueRule
This rule reports an error when a closure has a parameter with null
as default value.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Expressions
Expressions\NoCompactRule
This rule reports an error when the function compact()
is used.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Expressions\NoEvalRule
This rule reports an error when the language construct eval()
is used.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Expressions\NoErrorSuppressionRule
This rule reports an error when @
is used to suppress errors.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Expressions\NoIssetRule
This rule reports an error when the language construct isset()
is used.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Files
Files\DeclareStrictTypesRule
This rule reports an error when a non-empty file does not contain a declare(strict_types=1)
declaration.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Functions
Functions\NoNullableReturnTypeDeclarationRule
This rule reports an error when a function uses a nullable return type declaration.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Functions\NoParameterWithNullableTypeDeclarationRule
This rule reports an error when a function has a parameter with a nullable type declaration.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Functions\NoParameterWithNullDefaultValueRule
This rule reports an error when a function has a parameter with null
as default value.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Methods
Methods\FinalInAbstractClassRule
This rule reports an error when a concrete public
or protected
method in an abstract
class is not final
.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Methods\NoConstructorParameterWithDefaultValueRule
This rule reports an error when a constructor declared in
- an anonymous class
- a class
has a default value.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Methods\NoNullableReturnTypeDeclarationRule
This rule reports an error when a method declared in
- an anonymous class
- a class
- an interface
uses a nullable return type declaration.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Methods\NoParameterWithContainerTypeDeclarationRule
This rule reports an error when a method has a type declaration for a known dependency injection container or service locator.
Defaults
By default, this rule disallows the use of type declarations indicating an implementation of
is expected to be injected into a method.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Configuring container interfaces
You can set the interfacesImplementedByContainers
parameter to a list of interface names of additional containers and service locators.
Configuring methods allowed to use parameters with container type declarations
You can set the methodsAllowedToUseContainerTypeDeclarations
parameter to a list of method names that are allowed to use parameters with container type declarations.
Methods\NoParameterWithNullableTypeDeclarationRule
This rule reports an error when a method declared in
- an anonymous class
- a class
- an interface
has a parameter with a nullable type declaration.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Methods\NoParameterWithNullDefaultValueRule
This rule reports an error when a method declared in
- an anonymous class
- a class
- an interface
has a parameter with null
as default value.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Methods\PrivateInFinalClassRule
This rule reports an error when a method in a final
class is protected
but could be private
.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Statements
Statements\NoSwitchRule
This rule reports an error when the statement switch()
is used.
Disabling the rule
You can set the the enabled
parameter to false
to disable this rule.
Changelog
The maintainers of this project record notable changes to this project in a changelog.
Contributing
The maintainers of this project suggest following the contribution guide.
Code of Conduct
The maintainers of this project ask contributors to follow the code of conduct.
General Support Policy
The maintainers of this project provide limited support.
You can support the maintenance of this project by sponsoring @localheinz or requesting an invoice for services related to this project.
PHP Version Support Policy
This project supports PHP versions with active and security support.
The maintainers of this project add support for a PHP version following its initial release and drop support for a PHP version when it has reached the end of security support.
Security Policy
This project has a security policy.
License
This project uses the MIT license.
Credits
The method friendsofphp/php-cs-fixer
(originally licensed under MIT).
Social
Follow @localheinz and @ergebnis on Twitter.
All versions of phpstan-rules with dependencies
ext-mbstring Version *
nikic/php-parser Version ^4.2.3 || ^5.0.0
phpstan/phpstan Version ^1.10.21