Download the PHP package efabrica/phpstan-rules without Composer
On this page you can find all versions of the php package efabrica/phpstan-rules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phpstan-rules
eFabrica PHPStan extension
Extension for PHPStan is providing several services and rules to help find bugs in your applications.
Installation
To use this extension, require it in Composer:
Setup
This extension adds several rules. You can use them all by including these files in your phpstan.neon:
Or include just:
and pick rules you want to use
Guzzle - ClientCallWithoutOptionRule
Finds all calls of GuzzleHttp\Client methods without some option e.g. timeout, connect_timeout
:x:
:+1:
Tomaj/Nette API - InputParamNameRule
Checks if names of all input parameters. Every name has to contain only alphanumeric characters and _
:x:
:+1:
Check trait context - TraitContextRule
Checks if traits are used only in context of classes specified in them via comment @context {Type}
:x:
:+1:
Check calling method in object method
Checks if some method is not used in disabled context - specific method of object.
:x:
:+1:
Check calling method with required parameters
Checks if some method is called with all required parameters with corresponding types.
:x:
:+1:
Do not concatenate translated strings
Every language has its own word order in sentences, we can't use e.g. variables at the same place for all languages. There are mechanisms in translate libraries e.g. symfony/translator - we can use placeholders like %name% etc. This rule checks if you use translated messages and then concat them with some other strings.
:x:
:+1:
Forbidden constructor parameters types
This rule checks if constructor contains forbidden parameter types.
:x:
:+1:
Enforce arrow function
Checks closures and reports those that only contain a single return expression, because they can be replaced with fn.
This rule is optional and is not enabled by default in rules.neon.
:x:
:+1:
Performance - DisabledCallsInLoopsRule
Some functions are not recommended to be called in loops. For example array_merge.
:x:
:+1:
Performance - UseNetteDatabaseSelectionFetchTogetherWithLimitRule
Nette\Database\Table\Selection::fetch() should be used with limit(1) to avoid loading more rows than needed.
:x:
:+1:
Check calls in conditions
This rule checks if there are some (slow) calls (function call, method call, static method call) in if conditions before other expressions. There can be set list of slow calls in parameters. If not set, all calls are considered slower than other expressions.
:x:
:+1:
Performance - UseArrayComparisonInsteadOfCountInConditionRule
This rule checks if count($array) is used in if / elseif conditions for empty/non-empty checks and recommends array comparison with [].
:x:
:+1:
Nette DI - PresenterInjectedPropertiesExtension
Will not report uninitialized properties with @Inject or #[Inject] attribute.