Download the PHP package xactsystems/phpstan-extensions without Composer
On this page you can find all versions of the php package xactsystems/phpstan-extensions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xactsystems/phpstan-extensions
More information about xactsystems/phpstan-extensions
Files in xactsystems/phpstan-extensions
Package phpstan-extensions
Short Description A collection of PHPStan extensions found useful in our projects.
License MIT
Informations about the package phpstan-extensions
A collection of PHPStan extensions
This repo contains some useful PHPStan extension for detecting errors in your code. The currently list of rules is:
UnusedClassRule
UnusedTraitRule
Install
Usage
With PHPStan extension installer, everything is ready to run.
Otherwise manually enable the extension:
Rules
UnusedClassRule
This rule scans for class declarations and use statements. If a class is declared but not used within the scanned source files, an error is generated.
Disabling the rule
You can disable scanning classes as follows:
Excluding files
You can exclude directories and individual files from being scanned by this rule:
Excluding Services
By default, some known service and framework classes are excluded. There are a number of base classes from Symfony, Doctrine and PHPUnit that checked and, if matched, the class being analysed is ignored.
To disable this, set the excludeFrameworks property to false:
This list will change as new frameworks and classes are added. Please look at the source code in src/Frameworks for a list of base classes that are excluded.
If you want add a custom list of base classes to ignore, use the baseClassExcludes property:
Entries in baseClassExcludes are excluded regardless of the excludeFrameworks property value.
UnusedTraitRule
This rule scans for trait declarations and use statements. If a trait is declared but not used within the scanned source files, an error is generated.
Disabling the rule
You can disable scanning traits as follows:
Excluding files
You can exclude directories and individual files from being scanned by this rule using the excludePaths parameter as shown above.