From e0f5b841e8c617f1f25446f94c4fe73c51fcc0f5 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Mon, 10 Jan 2022 19:13:26 +0000 Subject: [PATCH] A whole bunch of phpdoc fixes --- CRM/ACL/API.php | 16 ++++++++-------- CRM/ACL/BAO/ACL.php | 18 +++++++++--------- CRM/Activity/BAO/ActivityType.php | 4 ++-- CRM/Admin/Form.php | 2 +- CRM/Admin/Form/Extensions.php | 2 +- CRM/Admin/Form/MessageTemplates.php | 2 +- CRM/Admin/Form/Options.php | 2 +- CRM/Admin/Form/PaymentProcessor.php | 4 ++-- CRM/Admin/Form/Setting/Localization.php | 6 +++--- CRM/Admin/Form/Setting/Mail.php | 2 +- CRM/Badge/BAO/Layout.php | 2 +- CRM/Campaign/BAO/Survey.php | 4 ++-- CRM/Contact/BAO/Contact.php | 18 +++++++++--------- CRM/Contact/BAO/Contact/Utils.php | 8 ++++---- CRM/Contact/BAO/Query.php | 2 +- CRM/Contact/Form/Task/Delete.php | 2 +- CRM/Contact/Form/Task/SMSCommon.php | 2 +- CRM/Core/DAO.php | 2 +- CRM/Core/IDS.php | 2 +- CRM/Profile/Page/Listings.php | 2 +- CRM/Report/Form.php | 4 ++-- CRM/SMS/Provider.php | 2 +- CRM/UF/Form/Group.php | 2 +- CRM/Upgrade/Incremental/php/FiveTwenty.php | 8 ++++---- CRM/Utils/Date.php | 2 +- CRM/Utils/REST.php | 2 +- CRM/Utils/Rule.php | 8 ++++---- CRM/Utils/Zip.php | 2 +- api/api.php | 3 ++- 29 files changed, 68 insertions(+), 67 deletions(-) diff --git a/CRM/ACL/API.php b/CRM/ACL/API.php index a1ffab79e1..a02fb38a7c 100644 --- a/CRM/ACL/API.php +++ b/CRM/ACL/API.php @@ -33,7 +33,7 @@ class CRM_ACL_API { * * @param string $str * The permission to check. - * @param int $contactID + * @param int|null $contactID * The contactID for whom the check is made. * * @return bool @@ -64,7 +64,7 @@ class CRM_ACL_API { * (reference ) add the tables that are needed for the select clause. * @param array $whereTables * (reference ) add the tables that are needed for the where clause. - * @param int $contactID + * @param int|null $contactID * The contactID for whom the check is made. * @param bool $onlyDeleted * Whether to include only deleted contacts. @@ -135,12 +135,12 @@ class CRM_ACL_API { * * @param int $type * The type of permission needed. - * @param int $contactID + * @param int|null $contactID * The contactID for whom the check is made. * * @param string $tableName - * @param null $allGroups - * @param null $includedGroups + * @param array|null $allGroups + * @param array|null $includedGroups * * @return array * the ids of the groups for which the user has permissions @@ -165,11 +165,11 @@ class CRM_ACL_API { * @param int $type * The type of permission needed. * @param int $groupID - * @param int $contactID + * @param int|null $contactID * The contactID for whom the check is made. * @param string $tableName - * @param null $allGroups - * @param null $includedGroups + * @param array|null $allGroups + * @param array|null $includedGroups * * @return bool */ diff --git a/CRM/ACL/BAO/ACL.php b/CRM/ACL/BAO/ACL.php index 82aaf8dabc..17d1f31383 100644 --- a/CRM/ACL/BAO/ACL.php +++ b/CRM/ACL/BAO/ACL.php @@ -83,7 +83,7 @@ class CRM_ACL_BAO_ACL extends CRM_ACL_DAO_ACL implements \Civi\Test\HookInterfac /** * Get all ACLs owned by a given contact, including domain and group-level. * - * @param int|null $contact_id + * @param int $contact_id * The contact ID. * * @return array @@ -185,7 +185,7 @@ SELECT acl.* } /** - * @param $str + * @param string $str * @param int $contactID * * @return bool @@ -219,9 +219,9 @@ SELECT count( a.id ) } /** - * @param $type - * @param $tables - * @param $whereTables + * @param int $type + * @param array $tables + * @param array $whereTables * @param int $contactID * * @return null|string @@ -314,8 +314,8 @@ SELECT g.* * @param int $type * @param int $contactID * @param string $tableName - * @param null $allGroups - * @param null $includedGroups + * @param array|null $allGroups + * @param array|null $includedGroups * * @return array */ @@ -385,7 +385,7 @@ SELECT g.* /** * @param int $type - * @param $operation + * @param string $operation * * @return bool */ @@ -456,7 +456,7 @@ SELECT g.* * @param int $contactID * @param string $tableName * @param int $type - * @param $allGroups + * @param array $allGroups * * @return array */ diff --git a/CRM/Activity/BAO/ActivityType.php b/CRM/Activity/BAO/ActivityType.php index 3a27f8275a..ba6f1ee3f2 100644 --- a/CRM/Activity/BAO/ActivityType.php +++ b/CRM/Activity/BAO/ActivityType.php @@ -37,7 +37,7 @@ class CRM_Activity_BAO_ActivityType { /** * Constructor * - * @param $activity_type_id int This matches up to the option_value 'value' column in the database. + * @param int $activity_type_id This matches up to the option_value 'value' column in the database. */ public function __construct($activity_type_id) { $this->setActivityType($activity_type_id); @@ -57,7 +57,7 @@ class CRM_Activity_BAO_ActivityType { * Look up the key/value pair representing this activity type from the id. * Generally called from constructor. * - * @param $activity_type_id int This matches up to the option_value 'value' column in the database. + * @param int $activity_type_id This matches up to the option_value 'value' column in the database. */ public function setActivityType($activity_type_id) { if ($activity_type_id && is_numeric($activity_type_id)) { diff --git a/CRM/Admin/Form.php b/CRM/Admin/Form.php index c7b5989c31..e7d06df668 100644 --- a/CRM/Admin/Form.php +++ b/CRM/Admin/Form.php @@ -30,7 +30,7 @@ class CRM_Admin_Form extends CRM_Core_Form { /** * The default values for form fields. * - * @var int + * @var array */ protected $_values; diff --git a/CRM/Admin/Form/Extensions.php b/CRM/Admin/Form/Extensions.php index 7ee7df2f91..83fba1bdcb 100644 --- a/CRM/Admin/Form/Extensions.php +++ b/CRM/Admin/Form/Extensions.php @@ -151,7 +151,7 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { * The input form values. * @param array $files * The uploaded files if any. - * @param array $self + * @param self $self * This object. * * @return bool|array diff --git a/CRM/Admin/Form/MessageTemplates.php b/CRM/Admin/Form/MessageTemplates.php index 076fcf3742..09c9f9e32c 100644 --- a/CRM/Admin/Form/MessageTemplates.php +++ b/CRM/Admin/Form/MessageTemplates.php @@ -244,7 +244,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Core_Form { * The input form values. * @param array $files * The uploaded files if any. - * @param array $self + * @param self $self * * @return array * array of errors diff --git a/CRM/Admin/Form/Options.php b/CRM/Admin/Form/Options.php index dc9fe05768..4afd0fbf70 100644 --- a/CRM/Admin/Form/Options.php +++ b/CRM/Admin/Form/Options.php @@ -342,7 +342,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { * The input form values. * @param array $files * The uploaded files if any. - * @param array $self + * @param self $self * Current form object. * * @return array diff --git a/CRM/Admin/Form/PaymentProcessor.php b/CRM/Admin/Form/PaymentProcessor.php index 8686d886b4..59cdafb0c4 100644 --- a/CRM/Admin/Form/PaymentProcessor.php +++ b/CRM/Admin/Form/PaymentProcessor.php @@ -295,8 +295,8 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { } /** - * @param $fields - * @param $errors + * @param array $fields + * @param array $errors * @param null $section * * @return bool diff --git a/CRM/Admin/Form/Setting/Localization.php b/CRM/Admin/Form/Setting/Localization.php index 5cd32ae551..17a4843f22 100644 --- a/CRM/Admin/Form/Setting/Localization.php +++ b/CRM/Admin/Form/Setting/Localization.php @@ -230,8 +230,8 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { /** * Replace available currencies by the ones provided * - * @param $currencies array of currencies ['USD', 'CAD'] - * @param $default default currency + * @param string[] $currencies array of currencies ['USD', 'CAD'] + * @param string $default default currency */ public static function updateEnabledCurrencies($currencies, $default) { @@ -339,7 +339,7 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { $currencies = array_keys(CRM_Core_OptionGroup::values('currencies_enabled')); if (!in_array($newCurrency, $currencies)) { if (empty($currencies)) { - $currencies = [$values['defaultCurrency']]; + $currencies = [$newCurrency]; } else { $currencies[] = $newCurrency; diff --git a/CRM/Admin/Form/Setting/Mail.php b/CRM/Admin/Form/Setting/Mail.php index 4bfe45d35a..4b49514c34 100644 --- a/CRM/Admin/Form/Setting/Mail.php +++ b/CRM/Admin/Form/Setting/Mail.php @@ -41,7 +41,7 @@ class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting { } /** - * @param $fields + * @param array $fields * * @return array|bool */ diff --git a/CRM/Badge/BAO/Layout.php b/CRM/Badge/BAO/Layout.php index 708be57502..2c0780e89e 100644 --- a/CRM/Badge/BAO/Layout.php +++ b/CRM/Badge/BAO/Layout.php @@ -145,7 +145,7 @@ class CRM_Badge_BAO_Layout extends CRM_Core_DAO_PrintLabel { /** * Decode encoded data and return as an array. * - * @param json $jsonData + * @param string $jsonData * Json object. * * @return array diff --git a/CRM/Campaign/BAO/Survey.php b/CRM/Campaign/BAO/Survey.php index 2fde9f3ec4..b05fce5c96 100644 --- a/CRM/Campaign/BAO/Survey.php +++ b/CRM/Campaign/BAO/Survey.php @@ -549,8 +549,8 @@ INNER JOIN civicrm_activity_contact activityAssignment * @param array $voterIds * @param bool $onlyCount * - * @return array - * An array of survey activity. + * @return array|int + * An array of survey activity, or an int if $onlyCount is set to TRUE */ public static function getSurveyActivities( $surveyId, diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 9e8aceb496..37aaf8c82e 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -233,7 +233,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact implements Civi\Te * @param bool $skipDelete * Unclear parameter, passed to website create * - * @return CRM_Contact_BAO_Contact|CRM_Core_Error + * @return CRM_Contact_BAO_Contact|CRM_Core_Error|NULL * Created or updated contribution object. We are deprecating returning an error in * favour of exceptions * @@ -550,7 +550,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact implements Civi\Te * @param bool $includeTypeInReturnParameters * Should type be part of the returned array? * - * @return array + * @return array|null * the displayName and contactImage for this contact */ public static function getDisplayAndImage($id, $includeTypeInReturnParameters = FALSE) { @@ -1840,16 +1840,16 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer'); * * $params int $contactId contact_id * $params boolean $isPrimaryExist if true, return primary contact location type otherwise null - * $params boolean $skipDefaultPriamry if true, return primary contact location type otherwise null + * $params boolean $skipDefaultPrimary if true, return primary contact location type otherwise null * * @param int $contactId - * @param bool $skipDefaultPriamry + * @param bool $skipDefaultPrimary * @param null $block * - * @return int + * @return int|NULL * $locationType location_type_id */ - public static function getPrimaryLocationType($contactId, $skipDefaultPriamry = FALSE, $block = NULL) { + public static function getPrimaryLocationType($contactId, $skipDefaultPrimary = FALSE, $block = NULL) { if ($block) { $entityBlock = ['contact_id' => $contactId]; $blocks = CRM_Core_BAO_Location::getValues($entityBlock); @@ -1891,7 +1891,7 @@ WHERE civicrm_contact.id = %1 "; if (isset($locationType)) { return $locationType; } - elseif ($skipDefaultPriamry) { + elseif ($skipDefaultPrimary) { // if there is no primary contact location then return null return NULL; } @@ -2765,7 +2765,7 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) $tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $custom['1'], 'table_name'); } $queryString = "SELECT count(id) FROM {$tableName} WHERE entity_id = {$contactId}"; - return CRM_Core_DAO::singleValueQuery($queryString); + return (int) CRM_Core_DAO::singleValueQuery($queryString); } } } @@ -3633,7 +3633,7 @@ LEFT JOIN civicrm_address ON ( civicrm_address.contact_id = civicrm_contact.id ) * @param array $appendProfiles * Name of profile(s) to append to each link. * - * @return array + * @return array|false */ public static function getEntityRefCreateLinks($appendProfiles = []) { // You'd think that "create contacts" would be the permission to check, diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index 6b2d129dc6..e93df1d595 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -139,8 +139,8 @@ WHERE id IN ( $idString ) * @param string $entityType * @param null $hashSize * - * @return array - * ( $cs, $ts, $live ) + * @return string + * (Underscore separated: $cs, $ts, $live ) * @throws \CRM_Core_Exception */ public static function generateChecksum($entityId, $ts = NULL, $live = NULL, $hash = NULL, $entityType = 'contact', $hashSize = NULL) { @@ -402,7 +402,7 @@ WHERE id IN ( $idString ) } } - //need to handle related meberships. CRM-3792 + //need to handle related memberships. CRM-3792 if ($previousEmpID != $employerID) { CRM_Contact_BAO_Relationship::relatedMemberships($contactID, $relationshipParams, $ids, $action); } @@ -455,7 +455,7 @@ WHERE id={$contactId}; "; $dao = CRM_Core_DAO::executeQuery($query); - // need to handle related meberships. CRM-3792 + // need to handle related memberships. CRM-3792 if ($employerId) { //1. disable corresponding relationship. //2. delete related membership. diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 09281671fc..d9ba6df7b8 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -4948,7 +4948,7 @@ civicrm_relationship.start_date > {$today} * * @param bool $skipOrderAndLimit * - * @return CRM_Core_DAO + * @return string|null|CRM_Core_DAO */ public function searchQuery( $offset = 0, $rowCount = 0, $sort = NULL, diff --git a/CRM/Contact/Form/Task/Delete.php b/CRM/Contact/Form/Task/Delete.php index 3f12db8140..c2c9b7b8e3 100644 --- a/CRM/Contact/Form/Task/Delete.php +++ b/CRM/Contact/Form/Task/Delete.php @@ -163,7 +163,7 @@ class CRM_Contact_Form_Task_Delete extends CRM_Contact_Form_Task { * The input form values. * @param array $files * The uploaded files if any. - * @param object $self + * @param self $self * Form object. * * @return bool|array diff --git a/CRM/Contact/Form/Task/SMSCommon.php b/CRM/Contact/Form/Task/SMSCommon.php index e4604aa6d9..5c9b2b90dc 100644 --- a/CRM/Contact/Form/Task/SMSCommon.php +++ b/CRM/Contact/Form/Task/SMSCommon.php @@ -274,7 +274,7 @@ class CRM_Contact_Form_Task_SMSCommon { * @param array $fields * The input form values. * @param array $dontCare - * @param array $self + * @param self $self * Additional values form 'this'. * * @return bool|array diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index 745b42ca1b..3e4dcba6d2 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -124,7 +124,7 @@ class CRM_Core_DAO extends DB_DataObject { /** * Class constructor. * - * @return \CRM_Core_DAO + * @return static */ public function __construct() { $this->initialize(); diff --git a/CRM/Core/IDS.php b/CRM/Core/IDS.php index 3efdac401b..fb8a01974a 100644 --- a/CRM/Core/IDS.php +++ b/CRM/Core/IDS.php @@ -226,7 +226,7 @@ class CRM_Core_IDS { /** * This function writes an entry about the intrusion to the database. * - * @param array $result + * @param IDS_Report $result * @param int $reaction * * @return bool diff --git a/CRM/Profile/Page/Listings.php b/CRM/Profile/Page/Listings.php index 38bfdb35d7..ab05516edf 100644 --- a/CRM/Profile/Page/Listings.php +++ b/CRM/Profile/Page/Listings.php @@ -17,7 +17,7 @@ /** * This implements the profile page for all contacts. It uses a selector - * object to do the actual dispay. The fields displayd are controlled by + * object to do the actual display. The fields displayed are controlled by * the admin. */ class CRM_Profile_Page_Listings extends CRM_Core_Page { diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 78ba43e17b..48dd35a9fc 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1115,7 +1115,7 @@ class CRM_Report_Form extends CRM_Core_Form { * @param string $group * @param string $grpFieldName * - * @return bool + * @return object|bool */ public function getElementFromGroup($group, $grpFieldName) { $eleObj = $this->getElement($group); @@ -2224,7 +2224,7 @@ class CRM_Report_Form extends CRM_Core_Form { /** * Get SQL where clause for contact subtypes - * @param string $field + * @param array $field Field specifications * @param mixed $value * @param string $op SQL Operator * diff --git a/CRM/SMS/Provider.php b/CRM/SMS/Provider.php index 896302ea13..c1f740b5b2 100644 --- a/CRM/SMS/Provider.php +++ b/CRM/SMS/Provider.php @@ -88,7 +88,7 @@ abstract class CRM_SMS_Provider { * * Child class could override this function to have better control over the message being sent. * - * @param string $message + * @param Mail_mime $message * @param int $contactID * @param array $contactDetails * diff --git a/CRM/UF/Form/Group.php b/CRM/UF/Form/Group.php index a270ae03ed..07d0c30e8f 100644 --- a/CRM/UF/Form/Group.php +++ b/CRM/UF/Form/Group.php @@ -326,7 +326,7 @@ class CRM_UF_Form_Group extends CRM_Core_Form { * The input form values. * @param array $files * The uploaded files if any. - * @param array $self + * @param self $self * Current form object. * * @return bool|array diff --git a/CRM/Upgrade/Incremental/php/FiveTwenty.php b/CRM/Upgrade/Incremental/php/FiveTwenty.php index df77f052c8..d6369f0713 100644 --- a/CRM/Upgrade/Incremental/php/FiveTwenty.php +++ b/CRM/Upgrade/Incremental/php/FiveTwenty.php @@ -118,8 +118,8 @@ class CRM_Upgrade_Incremental_php_FiveTwenty extends CRM_Upgrade_Incremental_Bas /** * Process a single case type * - * @param $caseTypeId int - * @param $definition string + * @param int $caseTypeId + * @param string $definition * xml string */ public static function processCaseTypeAutoassignee($caseTypeId, $definition) { @@ -213,9 +213,9 @@ class CRM_Upgrade_Incremental_php_FiveTwenty extends CRM_Upgrade_Incremental_Bas /** * Process a single case type for _changeCaseTypeLabelToName() * - * @param $isDryRun bool + * @param bool $isDryRun * If TRUE then don't actually change anything just report warnings. - * @param $caseTypeId int + * @param int $caseTypeId */ private static function _processCaseTypeLabelName($isDryRun, $caseTypeId) { $messages = []; diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php index d2a7bab78d..8248f671c7 100644 --- a/CRM/Utils/Date.php +++ b/CRM/Utils/Date.php @@ -913,7 +913,7 @@ class CRM_Utils_Date { * @param date $targetDate * Target Date. (show age on specific date) * - * @return int + * @return array * array $results contains years or months */ public static function calculateAge($birthDate, $targetDate = NULL) { diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index 03c7c26d1c..0604758d1a 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -48,7 +48,7 @@ class CRM_Utils_REST { * @param string $var * The string to be echoed. * - * @return string + * @return array */ public static function ping($var = NULL) { $session = CRM_Core_Session::singleton(); diff --git a/CRM/Utils/Rule.php b/CRM/Utils/Rule.php index 6d84ad5ec4..4e63ec0103 100644 --- a/CRM/Utils/Rule.php +++ b/CRM/Utils/Rule.php @@ -261,10 +261,10 @@ class CRM_Utils_Rule { } /** - * @param $value + * @param string $value * @param null $default * - * @return null + * @return string|null */ public static function date($value, $default = NULL) { if (is_string($value) && @@ -276,10 +276,10 @@ class CRM_Utils_Rule { } /** - * @param $value + * @param string $value * @param null $default * - * @return null|string + * @return string|null */ public static function dateTime($value, $default = NULL) { $result = $default; diff --git a/CRM/Utils/Zip.php b/CRM/Utils/Zip.php index a7dd244072..0337bd9b9d 100644 --- a/CRM/Utils/Zip.php +++ b/CRM/Utils/Zip.php @@ -80,7 +80,7 @@ class CRM_Utils_Zip { * Determine the name of the folder within a zip. * * @param ZipArchive $zip - * @param $expected + * @param string $expected * * @return string|bool * Return string or FALSE diff --git a/api/api.php b/api/api.php index 9ed9747dd0..b8aeec4e0d 100644 --- a/api/api.php +++ b/api/api.php @@ -125,7 +125,8 @@ function civicrm_api4(string $entity, string $action, array $params = [], $index * * @throws CiviCRM_API3_Exception * - * @return array + * @return array|int + * Dependant on the $action */ function civicrm_api3(string $entity, string $action, array $params = []) { $params['version'] = 3; -- 2.25.1