-
Notifications
You must be signed in to change notification settings - Fork 365
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
Fixes #925: Invalid E.164 format for pt_PT PhoneNumber Provider #926
base: 2.0
Are you sure you want to change the base?
Conversation
- 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.
- Add consts in order to be able to merge AREA_CODE and MOBILE_SERVICE_CODE.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 1 week if no further activity occurs. Thank you for your contributions. |
- Add tests for e164PhoneNumber, e164MobileNumber and e164LandlineNumber. - Simplify regex for phoneNumber. Note: - Regex for phoneNumber was duplicating some information. It also validated for landline numbers starting at 20 even tho it wasn't present in the provider $formats. - Regex for country code, mobile number and landline number could be placed in a const variable. The problem is: there's some issues with interpolating self/static variables and concatenation would probably be hard to read.
In #925, @pimjansen closed the issue saying:
As I explained in the reply to that, there were other PR's for different providers that fixed the same issue and it doesn't make much sense for a locale specific provider to not return locale specific data. This is a simple PR that fixes it:
Let me know if the new methods ( |
Can we do this PR on 1.x? For 2.x this code will be dropped and probably ported to a new repository |
Summary
Fix bug where
e164PhoneNumber
doesn't returnpt_PT
phone numbers when using the specificpt_PT
provider. 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
ande164LandlineNumber
to provide mobile-only and landline-only phone numbers, respectively.Add tests.
What is the reason for this PR?
e164MobileNumber
ande164LandlineNumber
to allow the users to retrieve only phone or landline numbers.Note: I wanted to use the same "formatting rules" for
$mobileNumberPrefixes
but I think there is some issue with the{{ }}
substitution since themobileNumber
method is static and there's not staticparse
method.Author's checklist
Review checklist
CHANGELOG.md