From 02b3ba91f63f837f75465d1c02aa631c0b80e7c7 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 24 Jul 2020 14:23:16 -0400 Subject: [PATCH] NFC - Fix @return annotation in CRM_Utils_Check_Component_* --- CRM/Utils/Check/Component/AddressParsing.php | 3 ++ CRM/Utils/Check/Component/Case.php | 8 ++-- CRM/Utils/Check/Component/Cms.php | 3 +- CRM/Utils/Check/Component/Env.php | 45 +++++++++---------- .../Check/Component/FinancialTypeAcls.php | 4 ++ CRM/Utils/Check/Component/OptionGroups.php | 2 +- CRM/Utils/Check/Component/PriceFields.php | 2 +- CRM/Utils/Check/Component/Schema.php | 9 ++-- CRM/Utils/Check/Component/Security.php | 17 ++++--- CRM/Utils/Check/Component/Source.php | 4 +- CRM/Utils/Check/Component/Timestamps.php | 2 +- 11 files changed, 53 insertions(+), 46 deletions(-) diff --git a/CRM/Utils/Check/Component/AddressParsing.php b/CRM/Utils/Check/Component/AddressParsing.php index 815402b48e..0d42a1771c 100644 --- a/CRM/Utils/Check/Component/AddressParsing.php +++ b/CRM/Utils/Check/Component/AddressParsing.php @@ -16,6 +16,9 @@ */ class CRM_Utils_Check_Component_AddressParsing extends CRM_Utils_Check_Component { + /** + * @return CRM_Utils_Check_Message[] + */ public static function checkLocaleSupportsAddressParsing() { $addressOptions = CRM_Core_BAO_Setting::valueOptions( diff --git a/CRM/Utils/Check/Component/Case.php b/CRM/Utils/Check/Component/Case.php index 4931f9f37f..962b844199 100644 --- a/CRM/Utils/Check/Component/Case.php +++ b/CRM/Utils/Check/Component/Case.php @@ -46,7 +46,7 @@ class CRM_Utils_Check_Component_Case extends CRM_Utils_Check_Component { /** * Check that the case-type names don't rely on double-munging. * - * @return array + * @return CRM_Utils_Check_Message[] * An empty array, or a list of warnings */ public function checkCaseTypeNameConsistency() { @@ -105,7 +105,7 @@ class CRM_Utils_Check_Component_Case extends CRM_Utils_Check_Component { /** * Check that the timestamp columns are populated. (CRM-20958) * - * @return array + * @return CRM_Utils_Check_Message[] * An empty array, or a list of warnings */ public function checkNullTimestamps() { @@ -149,7 +149,7 @@ class CRM_Utils_Check_Component_Case extends CRM_Utils_Check_Component { /** * Check that the relationship types aren't going to cause problems. * - * @return array + * @return CRM_Utils_Check_Message[] * An empty array, or a list of warnings */ public function checkRelationshipTypeProblems() { @@ -387,7 +387,7 @@ class CRM_Utils_Check_Component_Case extends CRM_Utils_Check_Component { * We don't have to think about edge cases because there are already * status checks above for those. * - * @return array + * @return CRM_Utils_Check_Message[] * An empty array, or a list of warnings */ public function checkExternalXmlFileRoleNames() { diff --git a/CRM/Utils/Check/Component/Cms.php b/CRM/Utils/Check/Component/Cms.php index 663d68037c..a1e8610db4 100644 --- a/CRM/Utils/Check/Component/Cms.php +++ b/CRM/Utils/Check/Component/Cms.php @@ -19,8 +19,7 @@ class CRM_Utils_Check_Component_Cms extends CRM_Utils_Check_Component { /** * For sites running in WordPress, make sure the configured base page exists. * - * @return array - * Instances of CRM_Utils_Check_Message + * @return CRM_Utils_Check_Message[] */ public static function checkWpBasePage() { $config = CRM_Core_Config::singleton(); diff --git a/CRM/Utils/Check/Component/Env.php b/CRM/Utils/Check/Component/Env.php index a81de7792c..76ae62ca5f 100644 --- a/CRM/Utils/Check/Component/Env.php +++ b/CRM/Utils/Check/Component/Env.php @@ -17,7 +17,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkPhpVersion() { $messages = []; @@ -82,7 +82,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { } /** - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkPhpMysqli() { $messages = []; @@ -107,7 +107,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Check that the MySQL time settings match the PHP time settings. * - * @return array an empty array, or a list of warnings + * @return CRM_Utils_Check_Message[] */ public function checkMysqlTime() { $messages = []; @@ -131,7 +131,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { } /** - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkDebug() { $config = CRM_Core_Config::singleton(); @@ -157,7 +157,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { } /** - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkOutboundMail() { $messages = []; @@ -188,7 +188,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Check that domain email and org name are set - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkDomainNameEmail() { $messages = []; @@ -238,7 +238,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Checks if a default bounce handling mailbox is set up - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkDefaultMailbox() { $messages = []; @@ -273,7 +273,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Checks if cron has run in the past hour (3600 seconds) - * @return array + * @return CRM_Utils_Check_Message[] * @throws CRM_Core_Exception */ public function checkLastCron() { @@ -337,7 +337,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Recommend that sites use path-variables for their directories and URLs. - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkUrlVariables() { $messages = []; @@ -374,7 +374,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Recommend that sites use path-variables for their directories and URLs. - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkDirVariables() { $messages = []; @@ -414,8 +414,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Check that important directories are writable. * - * @return array - * Any CRM_Utils_Check_Message instances that need to be generated. + * @return CRM_Utils_Check_Message[] */ public function checkDirsWritable() { $notWritable = []; @@ -463,7 +462,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Checks if new versions are available - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkVersion() { $messages = []; @@ -513,7 +512,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Checks if extensions are set up properly - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkExtensions() { $messages = []; @@ -708,7 +707,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Checks if there are pending extension upgrades. * - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkExtensionUpgrades() { if (CRM_Extension_Upgrades::hasPending()) { @@ -732,7 +731,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Checks if CiviCRM database version is up-to-date - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkDbVersion() { $messages = []; @@ -801,8 +800,8 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { } /** - * ensure that all CiviCRM tables are InnoDB - * @return array + * Ensure that all CiviCRM tables are InnoDB + * @return CRM_Utils_Check_Message[] */ public function checkDbEngine() { $messages = []; @@ -820,8 +819,8 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { } /** - * ensure reply id is set to any default value - * @return array + * Ensure reply id is set to any default value + * @return CRM_Utils_Check_Message[] */ public function checkReplyIdForMailing() { $messages = []; @@ -845,7 +844,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Check for required mbstring extension - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkMbstring() { $messages = []; @@ -864,7 +863,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Check if environment is Production. - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkEnvironment() { $messages = []; @@ -885,7 +884,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { /** * Check for utf8mb4 support by MySQL. * - * @return array an empty array, or a list of warnings + * @return CRM_Utils_Check_Message[] */ public function checkMysqlUtf8mb4() { $messages = []; diff --git a/CRM/Utils/Check/Component/FinancialTypeAcls.php b/CRM/Utils/Check/Component/FinancialTypeAcls.php index c46e93152b..05601e0778 100644 --- a/CRM/Utils/Check/Component/FinancialTypeAcls.php +++ b/CRM/Utils/Check/Component/FinancialTypeAcls.php @@ -16,6 +16,10 @@ */ class CRM_Utils_Check_Component_FinancialTypeAcls extends CRM_Utils_Check_Component { + /** + * @return CRM_Utils_Check_Message[] + * @throws CiviCRM_API3_Exception + */ public static function checkFinancialAclReport() { $messages = []; $ftAclSetting = Civi::settings()->get('acl_financial_type'); diff --git a/CRM/Utils/Check/Component/OptionGroups.php b/CRM/Utils/Check/Component/OptionGroups.php index 77a1679a14..a47303ad0d 100644 --- a/CRM/Utils/Check/Component/OptionGroups.php +++ b/CRM/Utils/Check/Component/OptionGroups.php @@ -17,7 +17,7 @@ class CRM_Utils_Check_Component_OptionGroups extends CRM_Utils_Check_Component { /** - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkOptionGroupValues() { $messages = []; diff --git a/CRM/Utils/Check/Component/PriceFields.php b/CRM/Utils/Check/Component/PriceFields.php index cfb6cf7114..03816c98fe 100644 --- a/CRM/Utils/Check/Component/PriceFields.php +++ b/CRM/Utils/Check/Component/PriceFields.php @@ -19,7 +19,7 @@ class CRM_Utils_Check_Component_PriceFields extends CRM_Utils_Check_Component { /** * Display warning about invalid priceFields - * + * @return CRM_Utils_Check_Message[] */ public function checkPriceFields() { $sql = "SELECT DISTINCT ps.title as ps_title, ps.id as ps_id, psf.label as psf_label diff --git a/CRM/Utils/Check/Component/Schema.php b/CRM/Utils/Check/Component/Schema.php index c1333dfa05..4e9e9c7ed7 100644 --- a/CRM/Utils/Check/Component/Schema.php +++ b/CRM/Utils/Check/Component/Schema.php @@ -19,7 +19,7 @@ class CRM_Utils_Check_Component_Schema extends CRM_Utils_Check_Component { /** * Check defined indices exist. * - * @return array + * @return CRM_Utils_Check_Message[] * @throws \CiviCRM_API3_Exception */ public function checkIndices() { @@ -62,7 +62,7 @@ class CRM_Utils_Check_Component_Schema extends CRM_Utils_Check_Component { } /** - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkMissingLogTables() { $messages = []; @@ -91,7 +91,7 @@ class CRM_Utils_Check_Component_Schema extends CRM_Utils_Check_Component { /** * Check that no smart groups exist that contain deleted custom fields. * - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkSmartGroupCustomFieldCriteria() { if (CRM_Core_BAO_Domain::isDBUpdateRequired()) { @@ -182,6 +182,9 @@ class CRM_Utils_Check_Component_Schema extends CRM_Utils_Check_Component { return $messages; } + /** + * @return CRM_Utils_Check_Message[] + */ public function checkMoneyValueFormatConfig() { $messages = []; if (CRM_Core_Config::singleton()->moneyvalueformat !== '%!i') { diff --git a/CRM/Utils/Check/Component/Security.php b/CRM/Utils/Check/Component/Security.php index 98f7b67267..943add05d4 100644 --- a/CRM/Utils/Check/Component/Security.php +++ b/CRM/Utils/Check/Component/Security.php @@ -20,6 +20,7 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component { * CMS have a different pattern to their default file path and URL. * * @todo Use Civi::paths instead? + * @return string */ public function getFilePathMarker() { $config = CRM_Core_Config::singleton(); @@ -47,8 +48,7 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component { * is browseable or visible to search engines; it means it can be * requested directly. * - * @return array - * Array of messages + * @return CRM_Utils_Check_Message[] * @see CRM-14091 */ public function checkLogFileIsNotAccessible() { @@ -100,8 +100,7 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component { * Being retrievable doesn't mean the files are browseable or visible * to search engines; it only means they can be requested directly. * - * @return array - * Array of messages + * @return CRM_Utils_Check_Message[] * @see CRM-14091 * * @todo Test with WordPress, Joomla. @@ -148,8 +147,7 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component { * MAY trigger false positives (if you have files named 'a', 'e' * we'll probably match that). * - * @return array - * Array of messages + * @return CRM_Utils_Check_Message[] * @see CRM-14091 * * @todo Test with WordPress, Joomla. @@ -192,7 +190,7 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component { * These files have generally been deleted but Civi source tree but could be * left online if one does a faulty upgrade. * - * @return array of messages + * @return CRM_Utils_Check_Message[] */ public function checkFilesAreNotPresent() { $packages_path = rtrim(\Civi::paths()->getPath('[civicrm.packages]/'), '/' . DIRECTORY_SEPARATOR); @@ -241,6 +239,7 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component { /** * Discourage use of remote profile forms. + * @return CRM_Utils_Check_Message[] */ public function checkRemoteProfile() { $messages = []; @@ -261,8 +260,8 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component { } /** - * Check that the sysadmin has not modified the Cxn - * security setup. + * Check that the sysadmin has not modified the Cxn security setup. + * @return CRM_Utils_Check_Message[] */ public function checkCxnOverrides() { $list = []; diff --git a/CRM/Utils/Check/Component/Source.php b/CRM/Utils/Check/Component/Source.php index 7a31d3341a..683f7cd3e3 100644 --- a/CRM/Utils/Check/Component/Source.php +++ b/CRM/Utils/Check/Component/Source.php @@ -58,7 +58,7 @@ class CRM_Utils_Check_Component_Source extends CRM_Utils_Check_Component { } /** - * @return array + * @return CRM_Utils_Check_Message[] * Each item is an array with keys: * - name: string, an abstract name * - path: string, a full file path @@ -99,7 +99,7 @@ class CRM_Utils_Check_Component_Source extends CRM_Utils_Check_Component { } /** - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkOrphans() { $orphans = $this->findOrphanedFiles(); diff --git a/CRM/Utils/Check/Component/Timestamps.php b/CRM/Utils/Check/Component/Timestamps.php index 3e9808acad..432a011e5f 100644 --- a/CRM/Utils/Check/Component/Timestamps.php +++ b/CRM/Utils/Check/Component/Timestamps.php @@ -21,7 +21,7 @@ class CRM_Utils_Check_Component_Timestamps extends CRM_Utils_Check_Component { /** * Check that various columns are TIMESTAMP and not DATETIME. (CRM-9683, etal) * - * @return array + * @return CRM_Utils_Check_Message[] */ public function checkSchema() { $problems = []; -- 2.25.1