Download the PHP package symplify/phpstan-rules without Composer
On this page you can find all versions of the php package symplify/phpstan-rules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download symplify/phpstan-rules
More information about symplify/phpstan-rules
Files in symplify/phpstan-rules
Package phpstan-rules
Short Description Set of Symplify rules for PHPStan
License MIT
Informations about the package phpstan-rules
PHPStan Rules
Set of rules for PHPStan used by Symplify projects
- See Rules Overview
Install
Note: Make sure you use phpstan/extension-installer
to load necessary service configs.
1. Add Prepared Sets
Sets are bunch of rules grouped by a common area, e.g. improve naming. You can pick from 5 sets:
Add sets one by one, fix what you find useful and ignore the rest.
Do you write custom Rector rules? Add rules for them too:
2. Cherry-pick Configurable Rules
There is one set with pre-configured configurable rules. Include it and see what is errors are found:
Would you like to tailor it to fit your taste? Pick one PHPStan rule and configure it manually ↓
3. Register Particular Rules
30 Rules Overview
AnnotateRegexClassConstWithRegexLinkRule
Add regex101.com link to that shows the regex in practise, so it will be easier to maintain in case of bug/extension in the future
- class:
Symplify\PHPStanRules\Rules\AnnotateRegexClassConstWithRegexLinkRule
:x:
:+1:
CheckClassNamespaceFollowPsr4Rule
Class like namespace "%s" does not follow PSR-4 configuration in composer.json
- class:
Symplify\PHPStanRules\Rules\CheckClassNamespaceFollowPsr4Rule
:x:
:+1:
CheckRequiredInterfaceInContractNamespaceRule
Interface must be located in "Contract" or "Contracts" namespace
- class:
Symplify\PHPStanRules\Rules\CheckRequiredInterfaceInContractNamespaceRule
:x:
:+1:
ClassNameRespectsParentSuffixRule
Class should have suffix "%s" to respect parent type
:wrench: configure it!
- class:
Symplify\PHPStanRules\Rules\ClassNameRespectsParentSuffixRule
↓
:x:
:+1:
ExplicitClassPrefixSuffixRule
Interface have suffix of "Interface", trait have "Trait" suffix exclusively
- class:
Symplify\PHPStanRules\Rules\Explicit\ExplicitClassPrefixSuffixRule
:x:
:+1:
ForbiddenArrayMethodCallRule
Array method calls [$this, "method"] are not allowed. Use explicit method instead to help PhpStorm, PHPStan and Rector understand your code
- class:
Symplify\PHPStanRules\Rules\Complexity\ForbiddenArrayMethodCallRule
:x:
:+1:
ForbiddenExtendOfNonAbstractClassRule
Only abstract classes can be extended
- class:
Symplify\PHPStanRules\Rules\ForbiddenExtendOfNonAbstractClassRule
:x:
:+1:
ForbiddenFuncCallRule
Function "%s()"
cannot be used/left in the code
:wrench: configure it!
- class:
Symplify\PHPStanRules\Rules\ForbiddenFuncCallRule
↓
:x:
:+1:
↓
:x:
:+1:
ForbiddenMultipleClassLikeInOneFileRule
Multiple class/interface/trait is not allowed in single file
- class:
Symplify\PHPStanRules\Rules\ForbiddenMultipleClassLikeInOneFileRule
:x:
:+1:
ForbiddenNodeRule
"%s" is forbidden to use
:wrench: configure it!
- class:
Symplify\PHPStanRules\Rules\ForbiddenNodeRule
↓
:x:
:+1:
ForbiddenStaticClassConstFetchRule
Avoid static access of constants, as they can change value. Use interface and contract method instead
- class:
Symplify\PHPStanRules\Rules\ForbiddenStaticClassConstFetchRule
:x:
:+1:
NoDynamicNameRule
Use explicit names over dynamic ones
- class:
Symplify\PHPStanRules\Rules\NoDynamicNameRule
:x:
:+1:
NoEntityOutsideEntityNamespaceRule
Class with #[Entity] attribute must be located in "Entity" namespace to be loaded by Doctrine
- class:
Symplify\PHPStanRules\Rules\NoEntityOutsideEntityNamespaceRule
:x:
:+1:
NoGlobalConstRule
Global constants are forbidden. Use enum-like class list instead
- class:
Symplify\PHPStanRules\Rules\NoGlobalConstRule
:x:
:+1:
NoInlineStringRegexRule
Use local named constant instead of inline string for regex to explain meaning by constant name
- class:
Symplify\PHPStanRules\Rules\NoInlineStringRegexRule
:x:
:+1:
NoReferenceRule
Use explicit return value over magic &reference
- class:
Symplify\PHPStanRules\Rules\NoReferenceRule
:x:
:+1:
NoReturnArrayVariableListRule
Use value object over return of values
- class:
Symplify\PHPStanRules\Rules\NoReturnArrayVariableListRule
:x:
:+1:
NoReturnSetterMethodRule
Setter method cannot return anything, only set value
- class:
Symplify\PHPStanRules\Rules\NoReturnSetterMethodRule
:x:
:+1:
NoSingleInterfaceImplementerRule
Interface "%s" has only single implementer. Consider using the class directly as there is no point in using the interface.
- class:
Symplify\PHPStanRules\Rules\NoSingleInterfaceImplementerRule
:x:
:+1:
NoTestMocksRule
Mocking "%s" class is forbidden. Use direct/anonymous class instead for better static analysis
- class:
Symplify\PHPStanRules\Rules\PHPUnit\NoTestMocksRule
:x:
:+1:
PreferredClassRule
Instead of "%s" class/interface use "%s"
:wrench: configure it!
- class:
Symplify\PHPStanRules\Rules\PreferredClassRule
↓
:x:
:+1:
PreventParentMethodVisibilityOverrideRule
Change "%s()"
method visibility to "%s" to respect parent method visibility.
- class:
Symplify\PHPStanRules\Rules\PreventParentMethodVisibilityOverrideRule
:x:
:+1:
RegexSuffixInRegexConstantRule
Name your constant with "_REGEX" suffix, instead of "%s"
- class:
Symplify\PHPStanRules\Rules\RegexSuffixInRegexConstantRule
:x:
:+1:
RequireAttributeNameRule
Attribute must have all names explicitly defined
- class:
Symplify\PHPStanRules\Rules\RequireAttributeNameRule
:x:
:+1:
RequireAttributeNamespaceRule
Attribute must be located in "Attribute" namespace
- class:
Symplify\PHPStanRules\Rules\Domain\RequireAttributeNamespaceRule
:x:
:+1:
RequireExceptionNamespaceRule
Exception
must be located in "Exception" namespace
- class:
Symplify\PHPStanRules\Rules\Domain\RequireExceptionNamespaceRule
:x:
:+1:
RequireInvokableControllerRule
Use invokable controller with __invoke()
method instead of named action method
- class:
Symplify\PHPStanRules\Symfony\Rules\RequireInvokableControllerRule
:x:
:+1:
RequireUniqueEnumConstantRule
Enum constants "%s" are duplicated. Make them unique instead
- class:
Symplify\PHPStanRules\Rules\Enum\RequireUniqueEnumConstantRule
:x:
:+1:
SeeAnnotationToTestRule
Class "%s" is missing @see
annotation with test case class reference
:wrench: configure it!
- class:
Symplify\PHPStanRules\Rules\SeeAnnotationToTestRule
↓
:x:
:+1:
UppercaseConstantRule
Constant "%s" must be uppercase
- class:
Symplify\PHPStanRules\Rules\UppercaseConstantRule
:x:
:+1:
Happy coding!
All versions of phpstan-rules with dependencies
phpstan/phpstan Version ^2.0
nette/utils Version ^3.2|^4.0
php Version ^7.4|^8.0