From a697795c08a77e7e2aefcd8af6e8b2b5ad1687df Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 5 Feb 2021 10:37:32 -0500 Subject: [PATCH] Minor documentation updates in Language and Languages classes --- wire/modules/LanguageSupport/Language.php | 2 ++ wire/modules/LanguageSupport/Languages.php | 23 ++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/wire/modules/LanguageSupport/Language.php b/wire/modules/LanguageSupport/Language.php index f6d29ff9..74ff9dcd 100644 --- a/wire/modules/LanguageSupport/Language.php +++ b/wire/modules/LanguageSupport/Language.php @@ -125,8 +125,10 @@ class Language extends Page { * See the `Languages::setLocale()` method for full details. * * @param int $category Optional category (default=LC_ALL) + * @return string|bool Returns the locale that was set or boolean false if requested locale cannot be set. * @see Languages::setLocale() * + * */ public function setLocale($category = LC_ALL) { return $this->wire('languages')->setLocale($category, $this); diff --git a/wire/modules/LanguageSupport/Languages.php b/wire/modules/LanguageSupport/Languages.php index a854539d..6ea65b06 100644 --- a/wire/modules/LanguageSupport/Languages.php +++ b/wire/modules/LanguageSupport/Languages.php @@ -368,7 +368,7 @@ class Languages extends PagesType { * - If you call with no arguments, it returns the current user language, same as `$user->language`, but using this * method may be preferable in some contexts, depending on how your IDE understands API calls. * - * @param string $name Specify language name (or ID) to get a specific language, or omit to get current language + * @param string|int $name Specify language name (or ID) to get a specific language, or omit to get current language * @return Language|NullPage|null * @since 3.0.127 * @@ -747,11 +747,26 @@ class Languages extends PagesType { * */ public function __get($key) { - if($key == 'tabs') return $this->wire('modules')->get('LanguageSupport')->getLanguageTabs(); - if($key == 'default') return $this->getDefault(); - if($key == 'support') return $this->wire('modules')->get('LanguageSupport'); + if($key === 'tabs') return $this->wire()->modules->get('LanguageSupport')->getLanguageTabs(); + if($key === 'default') return $this->getDefault(); + if($key === 'support') return $this->wire()->modules->get('LanguageSupport'); return parent::__get($key); } + + /** + * Get language or property + * + * (method repeated here for return value documentation purposes only) + * + * #pw-internal + * + * @param int|string $key + * @return Language|NullPage|null|mixed + * + */ + public function get($key) { + return parent::get($key); + } /** * Hook to WireDatabasePDO::unknownColumnError