PHPStan config for AirLST projects.
You can install the package via Composer:
composer require --dev airlst/phpstan-configMake sure to allow the phpstan/extension-installer plugin to run in your composer.json:
{
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
}
}Create a phpstan.php in the root of your project with the following contents:
<?php
declare(strict_types=1);
$factory = new Airlst\PhpstanConfig\Factory(['src']);
return $factory
->level(8)
->create();The constructor of the Factory class takes an array of paths to be scanned for PHP files and analyzed. You can pass any number of paths to it.
You can use following configuration options on the Factory class by chaining them before create() call:
level(int $level): Set the level of PHPStaninclude(string $file): Include additional PHPStan neon fileexclude(string $file): Exclude provided PHPStan neon filewithBleedingEdge(): Use bleeding edge version of PHPStanuseCacheDir(string $cacheDir): Use cache directory for PHPStantypeCoverage(int $return, int $param, int $property, int $constant): Set type coverage percentage, default is 100% for alltypePerfect(bool $nullOverFalse, bool $noMixedProperty, bool $noMixedCaller, bool $narrowParam, bool $narrowReturn): Set type perfect configuration, by default all turned on. See rectorphp/type-perfect README for more details.addRule(string $file): Add additional rule to PHPStanignoreError(string $message, ?string $path, ?int $count, ?bool $reportUnmatched): Ignore provided error messagecheckMissingIterableValueType(bool $enable = true): Enables/DisablescheckMissingIterableValueTyperulecheckGenericClassInNonGenericObjectType(bool $enable = true): Enables/DisablescheckGenericClassInNonGenericObjectTyperulestrictRules(): Enables/disables strict rules. For available method arguments you can checkphpstan/phpstan-strict-rulesdocumentation
Run PHPStan with the following command:
./vendor/bin/phpstan analyse -c phpstan.phpPlease see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.