From 3b4c3068606249f1912bfe45df57027619f2a165 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 25 Sep 2023 17:32:47 +0200 Subject: [PATCH] fix(phonenumber): Improve docs by adding input details Signed-off-by: Joas Schilling --- lib/private/PhoneNumberUtil.php | 15 ++------------- lib/public/IPhoneNumberUtil.php | 9 +++++++-- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/lib/private/PhoneNumberUtil.php b/lib/private/PhoneNumberUtil.php index 197ccaba035..a1eb2f13233 100644 --- a/lib/private/PhoneNumberUtil.php +++ b/lib/private/PhoneNumberUtil.php @@ -35,12 +35,7 @@ use OCP\IPhoneNumberUtil; */ class PhoneNumberUtil implements IPhoneNumberUtil { /** - * Returns the country code for a specific region - * - * For example, this would be `41` for Switzerland and `49` for Germany. - * Returns null when the region is invalid. - * - * @since 28.0.0 + * {@inheritDoc} */ public function getCountryCodeForRegion(string $regionCode): ?int { $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); @@ -49,13 +44,7 @@ class PhoneNumberUtil implements IPhoneNumberUtil { } /** - * Converts a given input into an E164 formatted phone number - * - * E164 is the international format without any formatting characters or spaces. - * E.g. +41446681800 where +41 is the region code. - * Returns null when the input is invalid for the given region. - * - * @since 28.0.0 + * {@inheritDoc} */ public function convertToStandardFormat(string $input, ?string $defaultRegion = null): ?string { $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); diff --git a/lib/public/IPhoneNumberUtil.php b/lib/public/IPhoneNumberUtil.php index 06f8c77706e..733de0e35a6 100644 --- a/lib/public/IPhoneNumberUtil.php +++ b/lib/public/IPhoneNumberUtil.php @@ -34,8 +34,10 @@ interface IPhoneNumberUtil { * Returns the country code for a specific region * * For example, this would be `41` for Switzerland and `49` for Germany. - * Returns null when there is no country code for the region. + * Returns null when the region is invalid. * + * @param string $regionCode Two-letter region code of ISO 3166-1 + * @return int|null Null when invalid/unsupported, the phone country code otherwise * @since 28.0.0 */ public function getCountryCodeForRegion(string $regionCode): ?int; @@ -44,8 +46,11 @@ interface IPhoneNumberUtil { * Converts a given input into an E164 formatted phone number * * E164 is the international format without any formatting characters or spaces. - * E.g. +41446681800 where +41 is the country code + * E.g. +41446681800 where +41 is the region code. * + * @param string $input Input phone number can contain formatting spaces, slashes and dashes + * @param string|null $defaultRegion Two-letter region code of ISO 3166-1 + * @return string|null Null when the input is invalid for the given region or requires a region. * @since 28.0.0 */ public function convertToStandardFormat(string $input, ?string $defaultRegion = null): ?string;