Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid E.164 format for pt_PT PhoneNumber Provider #925

Closed
Head0nF1re opened this issue Dec 13, 2024 · 2 comments · May be fixed by #926
Closed

Invalid E.164 format for pt_PT PhoneNumber Provider #925

Head0nF1re opened this issue Dec 13, 2024 · 2 comments · May be fixed by #926

Comments

@Head0nF1re
Copy link

Summary

According to PHPDoc/DockBlock, the Generator class should have the method e164PhoneNumber. However, calling fake('pt_PT')->unique()->e164PhoneNumber() (fake is a Laravel abstraction over Faker\Factory::create) returns numbers for multiple locales.

This happens because the pt_PT provider (Faker\Provider\pt_PT\PhoneNumber) doesn't override the property e164Formats from the base class in order to provide locale specific E.164 phone formats.

I will create a PR to fix the issue.

Versions

Version
PHP 8.3
fakerphp/faker 1.23
Head0nF1re added a commit to Head0nF1re/FakerPHP that referenced this issue Dec 13, 2024
- Override $e164Formats in order to provide locale specific phone
  numbers (mobile and landline) in E.164 format.

- Add constants / static properties for common formatting codes (country,
  area and mobile service).

- Add methods 'e164MobileNumber' and 'e164LandlineNumber' to provide
  mobile-only and landline-only phone numbers, respectively.
@pimjansen
Copy link

This is as intended since the method is not implemented for the locale itself

@pimjansen pimjansen closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2024
@Head0nF1re
Copy link
Author

This is as intended since the method is not implemented for the locale itself

@pimjansen What do you mean, did you have a look at the PR #926? It doesn't make much sense to have a factory to create locale specific generators that register providers that don't provide locale specific data, IMO.

If we look at similar issues:

We can see that they report the same thing. Also, if we look at each provider PhoneNumber class (uk_UA and en_US), the property $e164Formats is overridden in order to provide locale specific phone numbers.
The global ones can still be provided when using the base PhoneNumber class...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants