This PHPStan Reflection Extension can automatically register the methods and properties created by custom Faker providers, so you don't need to instruct PHPStan to ignore the usage of those methods.
Via Composer
composer require --dev swisnl/phpstan-faker
If you also have phpstan/extension-installer installed, then you don't need to follow the instructions for manual installation. Regardless of the installation method, you need to follow the instructions for configuration.
Manual installation
If you don't want to use phpstan/extension-installer
, include extension.neon in your project's PHPStan config:
includes:
- vendor/swisnl/phpstan-faker/extension.neon
Add the custom faker provider classes to the extension configuration.
parameters:
faker:
providerClasses:
- App\Faker\MyProvider
This does not actually register the custom providers in Faker, this just tells PHPStan about the custom providers.
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
If you discover any security related issues, please email security@swis.nl instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
SWIS is a web agency from Leiden, the Netherlands. We love working with open source software.