From 997183af6bc29439edbf45dc8d9be1ff44587e93 Mon Sep 17 00:00:00 2001 From: "v.carkaxhija" Date: Thu, 21 Nov 2024 10:31:28 +0100 Subject: [PATCH] remove str_starts_with because it is php 8 --- Service/Formatter/Address/PhoneFormatter.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Service/Formatter/Address/PhoneFormatter.php b/Service/Formatter/Address/PhoneFormatter.php index d4100ac84..8401e084e 100644 --- a/Service/Formatter/Address/PhoneFormatter.php +++ b/Service/Formatter/Address/PhoneFormatter.php @@ -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); } @@ -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; } } @@ -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); } }