From 3a06bf9efc6ed6e016f6b32db79289d90670ae93 Mon Sep 17 00:00:00 2001 From: Joshua Gigg Date: Tue, 8 Oct 2024 09:21:23 +0100 Subject: [PATCH] Fix PHP 8.4 compatibility --- build/BuildMetadataFromXml.php | 2 +- src/PhoneNumberUtil.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/BuildMetadataFromXml.php b/build/BuildMetadataFromXml.php index e22f8db1..09475778 100644 --- a/build/BuildMetadataFromXml.php +++ b/build/BuildMetadataFromXml.php @@ -585,7 +585,7 @@ public static function setPossibleLengthsGeneralDesc(PhoneNumberDesc $generalDes * @param int[] $lengths * @param int[] $localOnlyLengths */ - private static function setPossibleLengths(array $lengths, array $localOnlyLengths, PhoneNumberDesc $desc, PhoneNumberDesc $parentDesc = null): void + private static function setPossibleLengths(array $lengths, array $localOnlyLengths, PhoneNumberDesc $desc, ?PhoneNumberDesc $parentDesc = null): void { // We clear these fields since the metadata tends to inherit from the parent element for other // fields (via a mergeFrom). diff --git a/src/PhoneNumberUtil.php b/src/PhoneNumberUtil.php index d043ce93..d8880db0 100644 --- a/src/PhoneNumberUtil.php +++ b/src/PhoneNumberUtil.php @@ -397,9 +397,9 @@ protected function __construct(MetadataSourceInterface $metadataSource, array $c */ public static function getInstance( string $baseFileLocation = self::META_DATA_FILE_PREFIX, - array $countryCallingCodeToRegionCodeMap = null, - MetadataLoaderInterface $metadataLoader = null, - MetadataSourceInterface $metadataSource = null + ?array $countryCallingCodeToRegionCodeMap = null, + ?MetadataLoaderInterface $metadataLoader = null, + ?MetadataSourceInterface $metadataSource = null ): PhoneNumberUtil { if (static::$instance === null) { if ($countryCallingCodeToRegionCodeMap === null) { @@ -2969,7 +2969,7 @@ public function isValidNumberForRegion(PhoneNumber $number, string $regionCode): * and the number is not in international format (does not start * with +) */ - public function parse(string $numberToParse, ?string $defaultRegion = null, PhoneNumber $phoneNumber = null, bool $keepRawInput = false): PhoneNumber + public function parse(string $numberToParse, ?string $defaultRegion = null, ?PhoneNumber $phoneNumber = null, bool $keepRawInput = false): PhoneNumber { if ($phoneNumber === null) { $phoneNumber = new PhoneNumber();