FakerPHP / Faker

Faker is a PHP library that generates fake data for you
https://fakerphp.github.io
Other
3.58k stars 345 forks source link

Using deprecated DefaultGenerator in Faker\Provider\Base. #681

Closed kasperhartwich closed 1 year ago

kasperhartwich commented 1 year ago

Hi.

When using the optional() function in Faker\Provider\Base, it returns DefaultGenerator, which is deprecated. Shouldn't this be changed to use ChanceGenerator instead?

https://github.com/FakerPHP/Faker/blob/1d21cbcbf7b2f7f5b1aa4b415a7b80f31f35a57d/src/Faker/Provider/Base.php#L653

pimjansen commented 1 year ago

Where is stated that its deprecated?

kasperhartwich commented 1 year ago

Here: https://github.com/FakerPHP/Faker/blob/main/src/Faker/DefaultGenerator.php#L13 and this makes my tests fail: https://github.com/FakerPHP/Faker/blob/main/src/Faker/DefaultGenerator.php#L19C55-L19C55

pimjansen commented 1 year ago

Do you also have a code snippet on how to use it and reproduce it as mentioned in the bug template

localheinz commented 1 year ago

@kasperhartwich

It is deprecated and may be removed in 2.0.0.