A PHPStan rule for enforcing that every request has a corresponding factory.
You can install the package via composer:
composer require --dev worksome/phpstan-request-factoriesIf you have also installed phpstan/extension-installer then everything will work out of the box.
Manual installation
If you don't want to use phpstan/extension-installer, include extension.neon in your project's PHPStan config:
includes:
- vendor/worksome/phpstan-request-factories/extension.neon
The request and factory namespaces are both configurable. They can be configured using the following parameters:
requestFactories.requestsNamespace(default isApp\\Http\\Requests)requestFactories.factoriesNamespace(default isTests\\RequestFactories)
For example:
parameters:
requestFactories:
requestsNamespace: App\Http\Requests
factoriesNamespace: Tests\RequestFactoriesIf there are certain request classes that you want to exclude, you can exclude these using
the excludedRequestClasses parameter.
For example:
parameters:
requestFactories:
excludedRequestClasses:
- App\Http\Requests\IgnorableRequestcomposer testPlease see GitHub Releases for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.