Rename use class Provider for "inn" & "kpp" in Faker\Provider\ru_RU in docs
Opened this issue · 1 comments
livevasiliy commented
Summary
Hello @fzaninotto I want generate INN & KPP for Russian data, I add provider in my Laravel factory
like this:
/** @var Factory $factory */
use Faker\Generator as Faker;
use Illuminate\Database\Eloquent\Factory;
use Modules\Partner\Models\Partner;
use Modules\PartnerShop\Models\PartnerShop;
use Faker\Provider\ru_RU\Payment;
$factory->define(PartnerShop::class, function (Faker $faker) {
$faker->addProvider(Payment::class);
return [
'shop_name' => $faker->company,
'law_shop_name' => "{$faker->companySuffix} {$faker->company}",
'inn' => $faker->inn, // Error NOT FOUND in class Faker\Provider\ru_RU\Payment
'kpp' => $faker->kpp, // Error NOT FOUND in class Faker\Provider\ru_RU\Payment
'city' => $faker->city,
'address' => $faker->address,
'post_index' => $faker->postcode,
'partner_id' => \factory(Partner::class)
];
});
I open source code this class and found only method for
see https://github.com/fzaninotto/Faker#fakerproviderru_rupayment
$faker->bank
Screenshot source code class Payment from Provider\ru_RU\Payment.php
Versions
Version | |
---|---|
PHP | 7.3.16 |
fzaninotto/faker |
1.9.1 |
Self-enclosed code snippet for reproduction
<?php
require __DIR__ . '/vendor/autoload.php';
$faker = \Faker\Factory::create();
$faker->addProvider(\Faker\Provider\ru_RU\Payment::class);
echo $faker->inn;
echo $faker->kpp;
Expected output
Error for kpp
Fatal error: Uncaught InvalidArgumentException: Unknown formatter "kpp" in C:\Users\vasil\PhpstormProjects\untitled3\vendor\fzaninotto\faker\src\Faker\Generator.php:248
Stack trace:
#0 C:\Users\vasil\PhpstormProjects\untitled3\vendor\fzaninotto\faker\src\Faker\Generator.php(228): Faker\Generator->getFormatter('kpp')
#1 C:\Users\vasil\PhpstormProjects\untitled3\vendor\fzaninotto\faker\src\Faker\Generator.php(274): Faker\Generator->format('kpp')
#2 C:\Users\vasil\PhpstormProjects\untitled3\index.php(8): Faker\Generator->__get('kpp')
#3 {main}
thrown in C:\Users\vasil\PhpstormProjects\untitled3\vendor\fzaninotto\faker\src\Faker\Generator.php on line 248
Error for inn
Fatal error: Uncaught InvalidArgumentException: Unknown formatter "inn" in C:\Users\vasil\PhpstormProjects\untitled3\vendor\fzaninotto\faker\src\Faker\Generator.php:248
Stack trace:
#0 C:\Users\vasil\PhpstormProjects\untitled3\vendor\fzaninotto\faker\src\Faker\Generator.php(228): Faker\Generator->getFormatter('inn')
#1 C:\Users\vasil\PhpstormProjects\untitled3\vendor\fzaninotto\faker\src\Faker\Generator.php(274): Faker\Generator->format('inn')
#2 C:\Users\vasil\PhpstormProjects\untitled3\index.php(8): Faker\Generator->__get('inn')
#3 {main}
thrown in C:\Users\vasil\PhpstormProjects\untitled3\vendor\fzaninotto\faker\src\Faker\Generator.php on line 248
Actual output
for field inn except value like this "7813540735" and for kpp value - "781301001"
livevasiliy commented
I found solution error in used class Provider formaters 'inn' & 'kpp' place another class - Company.
@fzaninotto Rename class in docs from Payment to Company in this https://github.com/fzaninotto/Faker#fakerproviderru_rupayment