diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 63b615b1b..adb1dd4ae 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -12,5 +12,12 @@ '@PSR12' => true, '@PHP81Migration' => true, 'single_quote' => true, + 'no_unused_imports' => true, + 'no_superfluous_phpdoc_tags' => [ + 'allow_hidden_params' => true, + 'allow_mixed' => true, + 'remove_inheritdoc' => true, + ], + 'phpdoc_trim' => true, ] )->setFinder($finder); diff --git a/build/BuildMetadataFromXml.php b/build/BuildMetadataFromXml.php index 4fed0beb0..286d1b308 100644 --- a/build/BuildMetadataFromXml.php +++ b/build/BuildMetadataFromXml.php @@ -79,12 +79,8 @@ public static function validateRE(string $regex, bool $removeWhitespace = false) } /** - * - * @param DOMElement|string $inputXmlFile * @param boolean $liteBuild * @param boolean $specialBuild - * @param bool $isShortNumberMetadata - * @param bool $isAlternateFormatsMetadata * @return PhoneMetadata[] */ public static function buildPhoneMetadataCollection( @@ -127,11 +123,6 @@ public static function buildPhoneMetadataCollection( } /** - * @param string $regionCode - * @param DOMElement $element - * @param bool $isShortNumberMetadata - * @param bool $isAlternateFormatsMetadata - * @return PhoneMetadata */ public static function loadCountryMetadata(string $regionCode, DOMElement $element, bool $isShortNumberMetadata, bool $isAlternateFormatsMetadata): PhoneMetadata { @@ -150,11 +141,8 @@ public static function loadCountryMetadata(string $regionCode, DOMElement $eleme /** * Processes the custom build flags and gets a MetadataFilter which may be used to * filter PhoneMetadata objects. Incompatible flag combinations throw RuntimeException. - * @param bool $liteBuild - * @param bool $specialBuild - * @return MetadataFilter */ - public static function getMetadataFilter($liteBuild, $specialBuild): MetadataFilter + public static function getMetadataFilter(bool $liteBuild, bool $specialBuild): MetadataFilter { if ($specialBuild) { if ($liteBuild) { @@ -172,42 +160,27 @@ public static function getMetadataFilter($liteBuild, $specialBuild): MetadataFil /** * Returns the national prefix of the provided country element. * @internal - * @return string */ public static function getNationalPrefix(DOMElement $element): string { return $element->hasAttribute(self::NATIONAL_PREFIX) ? $element->getAttribute(self::NATIONAL_PREFIX) : ''; } - /** - * - * @internal - * @param string $nationalPrefix - * @return string - */ - public static function getNationalPrefixFormattingRuleFromElement(DOMElement $element, $nationalPrefix): string + public static function getNationalPrefixFormattingRuleFromElement(DOMElement $element, string $nationalPrefix): string { $nationalPrefixFormattingRule = $element->getAttribute(self::NATIONAL_PREFIX_FORMATTING_RULE); // Replace $NP with national prefix and $FG with the first group ($1). - $nationalPrefixFormattingRule = \str_replace( + return \str_replace( ['$NP', '$FG'], [$nationalPrefix, '$1'], $nationalPrefixFormattingRule ); - return $nationalPrefixFormattingRule; } - /** - * - * @internal - * @param string $regionCode - * @param string $nationalPrefix - * @return PhoneMetadata - */ public static function loadTerritoryTagMetadata( - $regionCode, + string $regionCode, DOMElement $element, - $nationalPrefix + string $nationalPrefix ): PhoneMetadata { $metadata = new PhoneMetadata(); $metadata->setId($regionCode); @@ -228,7 +201,7 @@ public static function loadTerritoryTagMetadata( $metadata->setNationalPrefixTransformRule(self::validateRE($element->getAttribute(self::NATIONAL_PREFIX_TRANSFORM_RULE))); } } - if ($nationalPrefix != '') { + if ($nationalPrefix !== '') { $metadata->setNationalPrefix($nationalPrefix); if (!$metadata->hasNationalPrefixForParsing()) { $metadata->setNationalPrefixForParsing($nationalPrefix); @@ -252,16 +225,13 @@ public static function loadTerritoryTagMetadata( * nationalPrefixOptionalWhenFormatting. The nationalPrefix, nationalPrefixFormattingRule and * nationalPrefixOptionalWhenFormatting values are provided from the parent (territory) element. * @internal - * @param string $nationalPrefix - * @param string $nationalPrefixFormattingRule - * @param bool $nationalPrefixOptionalWhenFormatting */ public static function loadAvailableFormats( PhoneMetadata $metadata, DOMElement $element, - $nationalPrefix, - $nationalPrefixFormattingRule, - $nationalPrefixOptionalWhenFormatting + string $nationalPrefix, + string $nationalPrefixFormattingRule, + bool $nationalPrefixOptionalWhenFormatting ): void { $carrierCodeFormattingRule = ''; if ($element->hasAttribute(self::CARRIER_CODE_FORMATTING_RULE)) { @@ -285,7 +255,7 @@ public static function loadAvailableFormats( $format->setNationalPrefixFormattingRule($nationalPrefixFormattingRule); } if ($numberFormatElement->hasAttribute(self::NATIONAL_PREFIX_OPTIONAL_WHEN_FORMATTING)) { - $format->setNationalPrefixOptionalWhenFormatting($numberFormatElement->getAttribute(self::NATIONAL_PREFIX_OPTIONAL_WHEN_FORMATTING) === 'true' ? true : false); + $format->setNationalPrefixOptionalWhenFormatting($numberFormatElement->getAttribute(self::NATIONAL_PREFIX_OPTIONAL_WHEN_FORMATTING) === 'true'); } else { $format->setNationalPrefixOptionalWhenFormatting($nationalPrefixOptionalWhenFormatting); } @@ -314,20 +284,16 @@ public static function loadAvailableFormats( } /** - * @internal - * @param string $nationalPrefix - * @return string */ - public static function getDomesticCarrierCodeFormattingRuleFromElement(DOMElement $element, $nationalPrefix): string + public static function getDomesticCarrierCodeFormattingRuleFromElement(DOMElement $element, string $nationalPrefix): string { $carrierCodeFormattingRule = $element->getAttribute(self::CARRIER_CODE_FORMATTING_RULE); // Replace $FG with the first group ($1) and $NP with the national prefix. - $carrierCodeFormattingRule = \str_replace( + return \str_replace( ['$NP', '$FG'], [$nationalPrefix, '$1'], $carrierCodeFormattingRule ); - return $carrierCodeFormattingRule; } /** @@ -345,8 +311,8 @@ public static function loadNationalFormat( $format->setPattern(self::validateRE($numberFormatElement->getAttribute(self::PATTERN))); $formatPattern = $numberFormatElement->getElementsByTagName(self::FORMAT); - if ($formatPattern->length != 1) { - $countryId = $metadata->getId() != '' ? $metadata->getId() : $metadata->getCountryCode(); + if ($formatPattern->length !== 1) { + $countryId = $metadata->getId() !== '' ? $metadata->getId() : $metadata->getCountryCode(); throw new \RuntimeException('Invalid number of format patterns for country: ' . $countryId); } $nationalFormat = $formatPattern->item(0)->firstChild->nodeValue; @@ -410,7 +376,6 @@ public static function loadInternationalFormat( /** * @internal - * @param bool $isShortNumberMetadata */ public static function setRelevantDescPatterns(PhoneMetadata $metadata, DOMElement $element, bool $isShortNumberMetadata): void { @@ -744,8 +709,6 @@ public static function processPhoneNumberDescElement( /** * @param int[] $possibleLengths - * @param PhoneNumberDesc $desc - * @return bool */ private static function arePossibleLengthsEqual(array $possibleLengths, PhoneNumberDesc $desc): bool { diff --git a/build/BuildMetadataPHPFromXml.php b/build/BuildMetadataPHPFromXml.php index 7f5e5e94a..7f8ce1c1d 100644 --- a/build/BuildMetadataPHPFromXml.php +++ b/build/BuildMetadataPHPFromXml.php @@ -48,7 +48,6 @@ public function start(string $inputFile, string $outputDir, string $filePrefix, /** * @param PhoneMetadata[] $metadataCollection - * @param string $filePrefix */ private function writeMetadataToFile(array $metadataCollection, string $filePrefix): void { @@ -70,9 +69,6 @@ private function writeMetadataToFile(array $metadataCollection, string $filePref /** * @param array> $countryCodeToRegionCodeMap - * @param string $outputDir - * @param string $mappingClass - * @return void */ private function writeCountryCallingCodeMappingToFile(array $countryCodeToRegionCodeMap, string $outputDir, string $mappingClass): void { diff --git a/build/Commands/BuildMetadataPHPFromXMLCommand.php b/build/Commands/BuildMetadataPHPFromXMLCommand.php index d877fd191..d630cd327 100644 --- a/build/Commands/BuildMetadataPHPFromXMLCommand.php +++ b/build/Commands/BuildMetadataPHPFromXMLCommand.php @@ -3,7 +3,6 @@ namespace libphonenumber\buildtools\Commands; use libphonenumber\buildtools\BuildMetadataPHPFromXml; -use PHPStan\Parallel\Process; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -36,7 +35,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $input->getArgument('DataPrefix'), $input->getArgument('MappingClass'), $input->getArgument('MappingClassLocation'), - ($input->getArgument('LiteBuild') === 'true') ? true : false + $input->getArgument('LiteBuild') === 'true' ); return self::SUCCESS; diff --git a/build/MetadataFilter.php b/build/MetadataFilter.php index 9b0db9569..61cdf0767 100644 --- a/build/MetadataFilter.php +++ b/build/MetadataFilter.php @@ -73,7 +73,6 @@ public static function forLiteBuild(): static * duplicates, malformed strings, or strings where field tokens do not correspond to strings in * the sets of excludable fields. We also throw RuntimeException for empty strings since such * strings should be treated as a special case by the flag checking code and not passed here. - * @param string $string * @return array */ public static function parseFieldMapFromString(string $string): array @@ -319,7 +318,6 @@ public function filterMetadata(PhoneMetadata $metadata): void /** * @param string $type - * @return PhoneNumberDesc */ private function getFiltered($type, PhoneNumberDesc $desc): PhoneNumberDesc { @@ -346,9 +344,6 @@ private function getFiltered($type, PhoneNumberDesc $desc): PhoneNumberDesc } /** - * @param $parent - * @param $child - * @return bool */ public function shouldDrop(string $parent, ?string $child = null): bool { diff --git a/src/Matcher.php b/src/Matcher.php index aa6e9e793..6aeacfd66 100644 --- a/src/Matcher.php +++ b/src/Matcher.php @@ -26,8 +26,6 @@ class Matcher private int $searchIndex = 0; /** - * @param string $pattern - * @param string $subject */ public function __construct(string $pattern, string $subject) { @@ -36,9 +34,6 @@ public function __construct(string $pattern, string $subject) } /** - * @param string $type - * @param int $offset - * @return bool */ protected function doMatch(string $type = 'find', int $offset = 0): bool { diff --git a/src/MultiFileMetadataSourceImpl.php b/src/MultiFileMetadataSourceImpl.php index 23f311570..852b288f2 100644 --- a/src/MultiFileMetadataSourceImpl.php +++ b/src/MultiFileMetadataSourceImpl.php @@ -40,7 +40,7 @@ public function __construct(protected MetadataLoaderInterface $metadataLoader, ? } /** - * @inheritdoc + * */ public function getMetadataForRegion(string $regionCode): PhoneMetadata { @@ -56,7 +56,7 @@ public function getMetadataForRegion(string $regionCode): PhoneMetadata } /** - * @inheritdoc + * */ public function getMetadataForNonGeographicalRegion(int $countryCallingCode): PhoneMetadata { @@ -68,10 +68,6 @@ public function getMetadataForNonGeographicalRegion(int $countryCallingCode): Ph } /** - * @param string $filePrefix - * @param string $regionCode - * @param int $countryCallingCode - * @param MetadataLoaderInterface $metadataLoader */ public function loadMetadataFromFile(string $filePrefix, string $regionCode, int $countryCallingCode, MetadataLoaderInterface $metadataLoader): void { diff --git a/src/NumberFormat.php b/src/NumberFormat.php index 7a24fe4ea..b60992c59 100644 --- a/src/NumberFormat.php +++ b/src/NumberFormat.php @@ -32,7 +32,6 @@ public function __construct() } /** - * @return NumberFormat */ public function clear(): NumberFormat { diff --git a/src/PhoneMetadata.php b/src/PhoneMetadata.php index e699428c2..0d3c955bd 100644 --- a/src/PhoneMetadata.php +++ b/src/PhoneMetadata.php @@ -90,8 +90,6 @@ public function numberFormatSize(): int } /** - * @param int $index - * @return NumberFormat */ public function getNumberFormat(int $index): NumberFormat { diff --git a/src/PhoneNumber.php b/src/PhoneNumber.php index f932dc903..165f42d00 100644 --- a/src/PhoneNumber.php +++ b/src/PhoneNumber.php @@ -9,7 +9,6 @@ class PhoneNumber implements \Serializable, \Stringable /** * The country calling code for this number, as defined by the International Telecommunication Union * (ITU). For example, this would be 1 for NANPA countries, and 33 for France. - */ protected ?int $countryCode = null; /** @@ -322,8 +321,6 @@ public function setExtension(string $value): PhoneNumber /** * Returns whether this phone number has the italian leading zero information set. - * - * @return bool */ public function hasItalianLeadingZero(): bool { @@ -506,7 +503,6 @@ public function equals(PhoneNumber $other): bool /** * Returns a string representation of this phone number. - * @return string */ public function __toString(): string { @@ -531,7 +527,7 @@ public function __toString(): string } /** - * @inheritDoc + * */ public function serialize(): ?string { @@ -556,7 +552,7 @@ public function __serialize(): array } /** - * @inheritDoc + * */ public function unserialize($data) { diff --git a/src/PhoneNumberMatch.php b/src/PhoneNumberMatch.php index f256d8f82..d1411c578 100644 --- a/src/PhoneNumberMatch.php +++ b/src/PhoneNumberMatch.php @@ -35,7 +35,6 @@ public function __construct(int $start, string $rawString, private PhoneNumber $ /** * Returns the phone number matched by the receiver. - * @return PhoneNumber */ public function number(): PhoneNumber { @@ -44,7 +43,6 @@ public function number(): PhoneNumber /** * Returns the start index of the matched phone number within the searched text. - * @return int */ public function start(): int { @@ -53,7 +51,6 @@ public function start(): int /** * Returns the exclusive end index of the matched phone number within the searched text. - * @return int */ public function end(): int { @@ -62,7 +59,6 @@ public function end(): int /** * Returns the raw string matched as a phone number in the searched text. - * @return string */ public function rawString(): string { diff --git a/src/PhoneNumberUtil.php b/src/PhoneNumberUtil.php index 608fdda6d..25f56c088 100644 --- a/src/PhoneNumberUtil.php +++ b/src/PhoneNumberUtil.php @@ -252,8 +252,6 @@ class PhoneNumberUtil * have alpha-characters and punctuation. * * Note VALID_PUNCTUATION starts with a -, so must be the first in the range. - * - * @var string */ protected static string $VALID_PHONE_NUMBER; /** @@ -340,7 +338,6 @@ class PhoneNumberUtil /** * This class implements a singleton, so the only constructor is protected. - * @param MetadataSourceInterface $metadataSource * @param array $countryCallingCodeToRegionCodeMap */ protected function __construct(MetadataSourceInterface $metadataSource, array $countryCallingCodeToRegionCodeMap) @@ -388,10 +385,7 @@ protected function __construct(MetadataSourceInterface $metadataSource, array $c *

The {@link PhoneNumberUtil} is implemented as a singleton. Therefore, calling getInstance * multiple times will only result in one instance being created. * - * @param string $baseFileLocation * @param array>|null $countryCallingCodeToRegionCodeMap - * @param MetadataLoaderInterface|null $metadataLoader - * @param MetadataSourceInterface|null $metadataSource * @return PhoneNumberUtil instance */ public static function getInstance( @@ -665,8 +659,6 @@ public function getSupportedCallingCodes(): array /** * Returns true if there is any possible number data set for a particular PhoneNumberDesc. - * - * @return bool */ protected static function descHasPossibleNumberData(PhoneNumberDesc $desc): bool { @@ -678,8 +670,6 @@ protected static function descHasPossibleNumberData(PhoneNumberDesc $desc): bool /** * Returns true if there is any data set for a particular PhoneNumberDesc. - * - * @return bool */ protected static function descHasData(PhoneNumberDesc $desc): bool { @@ -722,7 +712,6 @@ private function getSupportedTypesForMetadata(PhoneMetadata $metadata): array * * No types will be returned for invalid or unknown region codes. * - * @param string $regionCode * @return array Array of PhoneNumberType's */ public function getSupportedTypesForRegion(string $regionCode): array @@ -919,7 +908,6 @@ public function getNationalSignificantNumber(PhoneNumber $number): string /** * Returns the type of number passed in i.e Toll free, premium. * - * @param string $nationalNumber * @return int PhoneNumberType constant */ protected function getNumberTypeHelper(string $nationalNumber, PhoneMetadata $metadata): int @@ -1003,7 +991,6 @@ public function isNumberMatchingDesc(string $nationalNumber, PhoneNumberDesc $nu * * @param PhoneNumber|int $phoneNumberObjOrType A PhoneNumber object, or a PhoneNumberType integer * @param int|null $countryCallingCode Used when passing a PhoneNumberType - * @return bool */ public function isNumberGeographical(PhoneNumber|int $phoneNumberObjOrType, ?int $countryCallingCode = null): bool { @@ -1186,9 +1173,7 @@ public function format(PhoneNumber $number, int $numberFormat): string /** * A helper function that is used by format and formatByPattern. - * @param int $countryCallingCode * @param int $numberFormat PhoneNumberFormat - * @param string $formattedNumber */ protected function prefixNumberWithCountryCallingCode(int $countryCallingCode, int $numberFormat, string &$formattedNumber): void { @@ -1207,8 +1192,6 @@ protected function prefixNumberWithCountryCallingCode(int $countryCallingCode, i /** * Helper function to check the country calling code is valid. - * @param int $countryCallingCode - * @return bool */ protected function hasValidCountryCallingCode(int $countryCallingCode): bool { @@ -1234,10 +1217,7 @@ public function getRegionCodeForCountryCode(int $countryCallingCode): string * depending on whether it forms part of the NATIONAL format or INTERNATIONAL format. The * numberFormat parameter here is used to specify which format to use for those cases. If a * carrierCode is specified, this will be inserted into the formatted string to replace $CC. - * @param string $number * @param int $numberFormat PhoneNumberFormat - * @param null|string $carrierCode - * @return string */ protected function formatNsn(string $number, PhoneMetadata $metadata, int $numberFormat, ?string $carrierCode = null): string { @@ -1255,8 +1235,6 @@ protected function formatNsn(string $number, PhoneMetadata $metadata, int $numbe /** * @param NumberFormat[] $availableFormats - * @param string $nationalNumber - * @return NumberFormat|null */ public function chooseFormattingPatternForNumber(array $availableFormats, string $nationalNumber): ?NumberFormat { @@ -1283,10 +1261,7 @@ public function chooseFormattingPatternForNumber(array $availableFormats, string /** * Note that carrierCode is optional - if null or an empty string, no carrier code replacement * will take place. - * @param string $nationalNumber * @param int $numberFormat PhoneNumberFormat - * @param null|string $carrierCode - * @return string */ public function formatNsnUsingPattern( string $nationalNumber, @@ -1338,10 +1313,7 @@ public function formatNsnUsingPattern( * Appends the formatted extension of a phone number to formattedNumber, if the phone number had * an extension specified. * - * @param PhoneNumber $number - * @param PhoneMetadata|null $metadata * @param int $numberFormat PhoneNumberFormat - * @param string $formattedNumber */ protected function maybeAppendFormattedExtension(PhoneNumber $number, ?PhoneMetadata $metadata, int $numberFormat, string &$formattedNumber): void { @@ -1478,7 +1450,6 @@ public function parseAndKeepRawInput(string $numberToParse, ?string $defaultRegi /** * A helper function to set the values related to leading zeros in a PhoneNumber. - * @param string $nationalNumber */ public static function setItalianLeadingZerosForPhoneNumber(string $nationalNumber, PhoneNumber $phoneNumber): void { @@ -1706,8 +1677,6 @@ protected function isPhoneContextValid(?string $phoneContext): bool * Returns a new phone number containing only the fields needed to uniquely identify a phone * number, rather than any fields that capture the context in which the phone number was created. * These fields correspond to those set in parse() rather than parseAndKeepRawInput() - * - * @return PhoneNumber */ protected static function copyCoreFieldsOnly(PhoneNumber $phoneNumberIn): PhoneNumber { @@ -1728,8 +1697,6 @@ protected static function copyCoreFieldsOnly(PhoneNumber $phoneNumberIn): PhoneN /** * Converts numberToParse to a form that we can parse and write it to nationalNumber if it is * written in RFC3966; otherwise extract a possible number out of it and write to nationalNumber. - * @param string $numberToParse - * @param string $nationalNumber * @throws NumberParseException */ protected function buildNationalNumberForParsing(string $numberToParse, string &$nationalNumber): void @@ -2024,9 +1991,6 @@ public static function normalizeDigitsOnly(string $number): string } /** - * @param string $number - * @param bool $keepNonDigits - * @return string */ public static function normalizeDigits(string $number, bool $keepNonDigits): string { @@ -2051,9 +2015,6 @@ public static function normalizeDigits(string $number, bool $keepNonDigits): str /** * Strips the IDD from the start of the number if present. Helper function used by * maybeStripInternationalPrefixAndNormalize. - * @param string $iddPattern - * @param string $number - * @return bool */ protected function parsePrefixAsIdd(string $iddPattern, string &$number): bool { @@ -2079,9 +2040,6 @@ protected function parsePrefixAsIdd(string $iddPattern, string &$number): bool * Extracts country calling code from fullNumber, returns it and places the remaining number in nationalNumber. * It assumes that the leading plus sign or IDD has already been removed. * Returns 0 if fullNumber doesn't start with a valid country calling code, and leaves nationalNumber unmodified. - * @param string $fullNumber - * @param string $nationalNumber - * @return int * @internal */ protected function extractCountryCode(string $fullNumber, string &$nationalNumber): int @@ -2196,7 +2154,6 @@ public function isPossibleNumberForType(PhoneNumber $number, int $type): bool * Helper method to check a number against possible lengths for this number type, and determine * whether it matches, or is too short or too long. * - * @param string $number * @param int $type PhoneNumberType * @return int ValidationResult */ @@ -2284,7 +2241,6 @@ protected function testNumberLength(string $number, PhoneMetadata $metadata, int * Returns a list with the region codes that match the specific country calling code. For * non-geographical country calling codes, the region code 001 is returned. Also, in the case * of no region code being found, an empty list is returned. - * @param int $countryCallingCode * @return string[] */ public function getRegionCodesForCountryCode(int $countryCallingCode): array @@ -2486,7 +2442,6 @@ public function formatNationalNumberWithPreferredCarrierCode(PhoneNumber $number * currently all presumed to not be diallable from outside their country). * * @param PhoneNumber $number the phone-number for which we want to know whether it is diallable from outside the region - * @return bool */ public function canBeInternationallyDialled(PhoneNumber $number): bool { @@ -2722,7 +2677,6 @@ public function formatOutOfCountryCallingNumber(PhoneNumber $number, string $reg /** * Checks if this is a region under the North American Numbering Plan Administration (NANPA). - * @param string $regionCode * @return boolean true if regionCode is one of the regions under NANPA */ public function isNANPACountry(string $regionCode): bool @@ -2845,7 +2799,6 @@ public function formatInOriginalFormat(PhoneNumber $number, string $regionCallin } /** - * @return bool */ protected function hasFormattingPatternForNumber(PhoneNumber $number): bool { @@ -2896,10 +2849,6 @@ public function getNddPrefixForRegion(string $regionCode, bool $stripNonDigits): /** * Check if rawInput, which is assumed to be in the national format, has a national prefix. The * national prefix is assumed to be in digits-only form. - * @param string $rawInput - * @param string $nationalPrefix - * @param string $regionCode - * @return bool */ protected function rawInputContainsNationalPrefix(string $rawInput, string $nationalPrefix, string $regionCode): bool { @@ -3002,8 +2951,6 @@ public function isValidNumberForRegion(PhoneNumber $number, string $regionCode): * of the default region supplied. If the number is guaranteed to * start with a '+' followed by the country calling code, then * "ZZ" or null can be supplied. - * @param PhoneNumber|null $phoneNumber - * @param bool $keepRawInput * @return PhoneNumber a phone number proto buffer filled with the parsed number * @throws NumberParseException if the string is not considered to be a viable phone number (e.g. * too few or too many digits) or if no default region was supplied @@ -3213,7 +3160,6 @@ public function getExampleNumberForType(string|int $regionCodeOrType, ?int $type /** * @param int $type PhoneNumberType - * @return PhoneNumberDesc */ protected function getNumberDescByType(PhoneMetadata $metadata, int $type): PhoneNumberDesc { @@ -3403,7 +3349,6 @@ public function isNumberMatch(PhoneNumber|string $firstNumberIn, PhoneNumber|str /** * Returns true when one national number is the suffix of the other or both are the same. - * @return bool */ protected function isNationalNumberSuffixOfTheOther(PhoneNumber $firstNumber, PhoneNumber $secondNumber): bool { @@ -3419,7 +3364,6 @@ protected function isNationalNumberSuffixOfTheOther(PhoneNumber $firstNumber, Ph * * @param string $regionCode the region for which we want to know whether it supports mobile number * portability or not. - * @return bool */ public function isMobileNumberPortableRegion(string $regionCode): bool { diff --git a/src/ShortNumberInfo.php b/src/ShortNumberInfo.php index 80d630124..148239e53 100644 --- a/src/ShortNumberInfo.php +++ b/src/ShortNumberInfo.php @@ -214,10 +214,6 @@ public function connectsToEmergencyNumber(string $number, string $regionCode): b } /** - * @param string $number - * @param string $regionCode - * @param bool $allowPrefixMatch - * @return bool */ protected function matchesEmergencyNumberHelper(string $number, string $regionCode, bool $allowPrefixMatch): bool { @@ -328,7 +324,6 @@ public function isSmsServiceForRegion(PhoneNumber $number, string $regionDialing * codes. If the list contains more than one region, the first region for which the number is * valid is returned. * - * @param PhoneNumber $number * @param string[] $regionCodes * @return string|null Region Code (or null if none are found) */ @@ -637,9 +632,6 @@ protected function getNationalSignificantNumber(PhoneNumber $number): string /** * TODO: Once we have benchmarked ShortnumberInfo, consider if it is worth keeping * this performance optimization. - * @param string $number - * @param PhoneNumberDesc $numberDesc - * @return bool */ protected function matchesPossibleNumberAndNationalNumber(string $number, PhoneNumberDesc $numberDesc): bool { diff --git a/tests/Issues/UKNumbersTest.php b/tests/Issues/UKNumbersTest.php index b59eb99b0..c05bccdbb 100644 --- a/tests/Issues/UKNumbersTest.php +++ b/tests/Issues/UKNumbersTest.php @@ -2,7 +2,6 @@ namespace libphonenumber\Tests\Issues; -use libphonenumber\CountryCodeToRegionCodeMap; use libphonenumber\PhoneNumberFormat; use libphonenumber\PhoneNumberType; use libphonenumber\PhoneNumberUtil; diff --git a/tests/buildtools/BuildMetadataFromXmlTest.php b/tests/buildtools/BuildMetadataFromXmlTest.php index 6d935488b..9f3d1b24f 100644 --- a/tests/buildtools/BuildMetadataFromXmlTest.php +++ b/tests/buildtools/BuildMetadataFromXmlTest.php @@ -1,6 +1,5 @@ $array - * @return bool */ private function recursive_ksort(array $array): bool { @@ -961,7 +960,6 @@ private function getFakeArmeniaPhoneMetadata(): PhoneMetadata /** * @param bool $generalDesc - * @return PhoneNumberDesc */ private function getFakeArmeniaPhoneNumberDesc($generalDesc): PhoneNumberDesc { diff --git a/tests/core/ExampleNumbersTest.php b/tests/core/ExampleNumbersTest.php index 92d265bbc..2e7846c6a 100644 --- a/tests/core/ExampleNumbersTest.php +++ b/tests/core/ExampleNumbersTest.php @@ -81,10 +81,7 @@ public function testFixedLineOrMobile(string $region): void } /** - * @param int $exampleNumberRequestedType * @param array $possibleExpectedTypes - * @param string $regionCode - * @return void */ private function checkNumbersValidAndCorrectType( int $exampleNumberRequestedType, diff --git a/tests/core/MatcherTest.php b/tests/core/MatcherTest.php index cff35132b..75cc98c5d 100644 --- a/tests/core/MatcherTest.php +++ b/tests/core/MatcherTest.php @@ -46,9 +46,6 @@ private function checkMatcherBehavesAsExpected(MatcherAPIInterface $matcher): vo /** * Helper method to set national number fields in the PhoneNumberDesc proto. Empty fields won't be * set. - * - * @param string $nationalNumberPattern - * @return PhoneNumberDesc */ private function createDesc(string $nationalNumberPattern): PhoneNumberDesc {