May 5, 2017
0
Level 8
PHPStorm autocomplete for custom faker provider class
I'm trying to create my custom Faker Provider,
<?php
namespace Faker\Provider;
class FakerSlot extends Base
{
public static function aams_id()
{
return static::regexify('[J-O]N0[1-9]{7}[A-Z]{1}');
}
}
i put the php file in the database\providers directory, i would like to enable autocompletion with PHPStorm when i add the provider to the Faker\Generator
$factory->define(App\Slot::class, function (Faker\Generator $faker)
{
$faker->addProvider(new FakerSlot($faker));
$faker->slot //autocompletion should pop-up now
}
How i can do that? Why the Faker\Generator class have it's own autocompletion and mine is only recognized if i declare a new class like that
$fakerSlot = new Faker\Provider\FakerSlot;
$fakerSlot->slot //now the autocompletion pop-up
? I'm using the barryvdh ide-helper.
Please or to participate in this conversation.