Make handling of UK country code consistent between Number::Phone::UK and Number::Phone::Lib #88
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When given both an alpha-2 country code, and a number with an international country calling code prefix, the behaviour of Number::Phone::UK and Number::Phone::Lib is inconsistent.
Number::Phone::Lib strips the "+" from the number, causing the alpha-2 country code to take priority. For example, "+238 989 12 34" is a valid Cape Verde number. Removing the "+" prefix gives a valid UK number (albeit without the leading zero). Given "GB" and "+238 989 12 34", Number::Phone::Lib will return a UK object for "+44 23 8989 1234", whereas Number::Phone will return undef, because the number fails the basic UK number length check.
Given "+238 989 12 3", which is an invalid Cape Verde number, and an invalid UK number, Number::Phone::Lib will return undef. Number::Phone, however, returns a Number::Phone::UK object, which when formatted returns "+44+238989123".
This PR causes Number::Phone::UK to behave in the same way as Number::Phone::Lib.