Skip to content

Commit

Permalink
remove str_starts_with because it is php 8
Browse files Browse the repository at this point in the history
  • Loading branch information
vegimcarkaxhija committed Nov 21, 2024
1 parent 6dea08f commit 997183a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Service/Formatter/Address/PhoneFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private function formatPhoneNumber(string $phoneNumber, string $country): string
}

// Prepend starting notation for supported local numbers
if ($phoneLength === 10 && !str_starts_with($phoneNumber, $startingNotation)) {
if ($phoneLength === 10 && strpos($phoneNumber, $startingNotation) !== 0) {
$phoneNumber = $startingNotation . substr($phoneNumber, 1);
}

Expand All @@ -141,7 +141,7 @@ private function formatPhoneNumber(string $phoneNumber, string $country): string
private function isMobileNumber(string $phoneNumber, string $country): bool
{
foreach (self::VALID_MOBILE[$country] ?? [] as $prefix) {
if (str_starts_with($phoneNumber, $prefix)) {
if (strpos($phoneNumber, $prefix) === 0) {
return true;
}
}
Expand All @@ -158,7 +158,7 @@ private function isMobileNumber(string $phoneNumber, string $country): bool
private function applyInvalidNotationCorrection(string $phoneNumber, string $country): string
{
foreach (self::INVALID_NOTATION[$country] ?? [] as $invalidPrefix) {
if (str_starts_with($phoneNumber, $invalidPrefix)) {
if (strpos($phoneNumber, $invalidPrefix) === 0) {
$phoneNumber = $this->replaceInvalidNotation($phoneNumber, $invalidPrefix, $country);
}
}
Expand Down

0 comments on commit 997183a

Please sign in to comment.