Skip to content

Commit 9ed7545

Browse files
committed
Use str_starts_with()
1 parent ba03072 commit 9ed7545

19 files changed

+20
-20
lines changed

src/Formatter/ADFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class ADFormatter implements CountryPostcodeFormatter
1919
{
2020
public function format(string $postcode) : ?string
2121
{
22-
if (substr($postcode, 0, 2) === 'AD') {
22+
if (str_starts_with($postcode, 'AD')) {
2323
$postcode = substr($postcode, 2);
2424
}
2525

src/Formatter/AXFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function format(string $postcode) : ?string
2323
$prefix = false;
2424

2525
if ($length === 7) {
26-
if (substr($postcode, 0, 2) !== 'AX') {
26+
if (!str_starts_with($postcode, 'AX')) {
2727
return null;
2828
}
2929

@@ -37,7 +37,7 @@ public function format(string $postcode) : ?string
3737
return null;
3838
}
3939

40-
if (substr($postcode, 0, 2) !== '22') {
40+
if (!str_starts_with($postcode, '22')) {
4141
return null;
4242
}
4343

src/Formatter/AZFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class AZFormatter implements CountryPostcodeFormatter
1919
{
2020
public function format(string $postcode) : ?string
2121
{
22-
if (substr($postcode, 0, 2) === 'AZ') {
22+
if (str_starts_with($postcode, 'AZ')) {
2323
$postcode = substr($postcode, 2);
2424
}
2525

src/Formatter/BBFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class BBFormatter implements CountryPostcodeFormatter
1919
{
2020
public function format(string $postcode) : ?string
2121
{
22-
if (substr($postcode, 0, 2) === 'BB') {
22+
if (str_starts_with($postcode, 'BB')) {
2323
$postcode = substr($postcode, 2);
2424
}
2525

src/Formatter/CYFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function format(string $postcode) : ?string
3434
return null;
3535
}
3636

37-
if (substr($postcode, 0, 2) !== '99') {
37+
if (!str_starts_with($postcode, '99')) {
3838
return null;
3939
}
4040

src/Formatter/GFFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function format(string $postcode) : ?string
2121
return null;
2222
}
2323

24-
if (substr($postcode, 0, 3) !== '973') {
24+
if (!str_starts_with($postcode, '973')) {
2525
return null;
2626
}
2727

src/Formatter/KYFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class KYFormatter implements CountryPostcodeFormatter
1818
{
1919
public function format(string $postcode) : ?string
2020
{
21-
if (substr($postcode, 0, 2) !== 'KY') {
21+
if (!str_starts_with($postcode, 'KY')) {
2222
return null;
2323
}
2424

src/Formatter/LTFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function format(string $postcode) : ?string
2626
$prefix = false;
2727

2828
if ($length === 7) {
29-
if (substr($postcode, 0, 2) !== 'LT') {
29+
if (!str_starts_with($postcode, 'LT')) {
3030
return null;
3131
}
3232

src/Formatter/LVFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class LVFormatter implements CountryPostcodeFormatter
2121
{
2222
public function format(string $postcode) : ?string
2323
{
24-
if (substr($postcode, 0, 2) === 'LV') {
24+
if (str_starts_with($postcode, 'LV')) {
2525
$postcode = substr($postcode, 2);
2626
}
2727

src/Formatter/MCFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function format(string $postcode) : ?string
2626
return null;
2727
}
2828

29-
if (substr($postcode, 0, 3) !== '980') {
29+
if (!str_starts_with($postcode, '980')) {
3030
return null;
3131
}
3232

0 commit comments

Comments
 (0)