Skip to content

Commit 997183a

Browse files
remove str_starts_with because it is php 8
1 parent 6dea08f commit 997183a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Service/Formatter/Address/PhoneFormatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private function formatPhoneNumber(string $phoneNumber, string $country): string
124124
}
125125

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

@@ -141,7 +141,7 @@ private function formatPhoneNumber(string $phoneNumber, string $country): string
141141
private function isMobileNumber(string $phoneNumber, string $country): bool
142142
{
143143
foreach (self::VALID_MOBILE[$country] ?? [] as $prefix) {
144-
if (str_starts_with($phoneNumber, $prefix)) {
144+
if (strpos($phoneNumber, $prefix) === 0) {
145145
return true;
146146
}
147147
}
@@ -158,7 +158,7 @@ private function isMobileNumber(string $phoneNumber, string $country): bool
158158
private function applyInvalidNotationCorrection(string $phoneNumber, string $country): string
159159
{
160160
foreach (self::INVALID_NOTATION[$country] ?? [] as $invalidPrefix) {
161-
if (str_starts_with($phoneNumber, $invalidPrefix)) {
161+
if (strpos($phoneNumber, $invalidPrefix) === 0) {
162162
$phoneNumber = $this->replaceInvalidNotation($phoneNumber, $invalidPrefix, $country);
163163
}
164164
}

0 commit comments

Comments
 (0)