fzaninotto / Faker

Faker is a PHP library that generates fake data for you
MIT License
26.78k stars 3.58k forks source link

French phone numbers invalid for libphonenumber #1873

Open williamdes opened 4 years ago

williamdes commented 4 years ago

Summary

Ref: https://github.com/giggsey/libphonenumber-for-php/issues/352

Faker generates french phone numbers like +33 (0)4 06 21 24 41 that are not considered valid for https://libphonenumber.appspot.com/phonenumberparser?number=%2B33+%280%294+06+21+24+41&country=FR (https://github.com/giggsey/libphonenumber-for-php/issues/352#issuecomment-564572213)

Versions

Version
PHP 7.2.24
fzaninotto/faker 1.9.1

Self-enclosed code snippet for reproduction

$faker->phoneNumber()

Expected output

https://libphonenumber.appspot.com/phonenumberparser?number=+33%20(0)4%2010%2021%2024%2041&country=FR https://www.frameip.com/plan-numerotation-telephonique/ https://telecommunications.monsite-orange.fr/page-559951e5d006c.html image image

+33 4 10 21 24 41

Actual output

+33 (0)4 06 21 24 41

If their an option to have libphonenumber/google valid phone numbers ?

williamdes commented 4 years ago

@fzaninotto maybe Faker can not do nothing for this issue ?

williamdes commented 4 years ago

@fzaninotto I added some links and pictures

fzaninotto commented 4 years ago

Thanks. Indeed, the French PhoneNumber provider could be improved to generate only valid numbers. Would you like to work on a patch?

williamdes commented 4 years ago

@fzaninotto If you have time you can patch the issue, I think I will have time in ~1-2 weeks

williamdes commented 4 years ago

@fzaninotto if you want to fix it then go ahead, I am not having the time needed for this issue soon

jonatanbzk commented 4 years ago

I checked this issue and fixed it changing this file : Faker/src/Faker/Provider/fr_FR/PhoneNumber.php faker

The result looks ok and the tests also passed.