From: eileen Date: Thu, 23 May 2019 01:01:59 +0000 (+1200) Subject: Docblock fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e97c66ff6b6e60f50f0aeafae66a864fae514414;p=civicrm-core.git Docblock fixes These are the drupal coder standard but with less rules commented out. Note the null vs NULL is coming from there. I think we can now merge https://github.com/civicrm/coder/pull/7 without undue pain on submitters. --- diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index 222860016a..e92d664781 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -2046,7 +2046,8 @@ SELECT civicrm_contact.id as casemanager_id, * * @param bool $changeClient * - * @return int|NULL + * @return int|null + * @throws \CRM_Core_Exception */ public static function mergeCases( $mainContactId, $mainCaseId = NULL, $otherContactId = NULL, diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 5a22a86d78..cf540790ed 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -582,9 +582,11 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer'); * Alternatively we should choose from enabled countries, prioritising the default country. * * @param array $values - * @param int|NULL $countryID + * @param int|null $countryID * * @return int|null + * + * @throws \CRM_Core_Exception */ protected static function resolveStateProvinceID($values, $countryID) { @@ -3628,7 +3630,7 @@ LEFT JOIN civicrm_address ON ( civicrm_address.contact_id = civicrm_contact.id ) * @param array $contextParams * The context if relevant, eg. ['event_id' => X] * - * @return int|NULL + * @return int|null */ public static function getFirstDuplicateContact($input, $contactType, $rule = 'Unsupervised', $excludedContactIDs = [], $checkPermissions = TRUE, $ruleGroupID = NULL, $contextParams = []) { $ids = self::getDuplicateContacts($input, $contactType, $rule, $excludedContactIDs, $checkPermissions, $ruleGroupID, $contextParams); diff --git a/CRM/Contact/BAO/Contact/Permission.php b/CRM/Contact/BAO/Contact/Permission.php index 731958c98a..80cbe37847 100644 --- a/CRM/Contact/BAO/Contact/Permission.php +++ b/CRM/Contact/BAO/Contact/Permission.php @@ -146,7 +146,7 @@ WHERE contact_id IN ({$contact_id_list}) return TRUE; } - # FIXME: push this somewhere below, to not give this permission so many rights + // FIXME: push this somewhere below, to not give this permission so many rights $isDeleted = (bool) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $id, 'is_deleted'); if (CRM_Core_Permission::check('access deleted contacts') && $isDeleted) { return TRUE; diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index 7c36b4c5ae..a839ce5626 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -1087,7 +1087,7 @@ WHERE id IN (" . implode(',', $contactIds) . ")"; * @param string $greetingType * Greeting type. * - * @return int|NULL + * @return int|null */ public static function defaultGreeting($contactType, $greetingType) { $contactTypeFilters = [ diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index e7ec4a8de8..a2e5905f15 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -1044,7 +1044,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { * @param array $groupIDs * Array of group ids. * - * @param NULL $parents + * @param string $parents * @param string $spacer * @param bool $titleOnly * diff --git a/CRM/Contact/BAO/GroupContact.php b/CRM/Contact/BAO/GroupContact.php index c4540d79d5..141b0ffeb2 100644 --- a/CRM/Contact/BAO/GroupContact.php +++ b/CRM/Contact/BAO/GroupContact.php @@ -165,7 +165,7 @@ class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact { * * @param string $method * @param string $status - * @param NULL $tracking + * @param string $tracking * * @return array * (total, removed, notRemoved) count of contacts removed to group @@ -698,7 +698,7 @@ AND group_id IN ( $groupIDString ) * The id of the group. * @param string $method * @param string $status - * @param NULL $tracking + * @param string $tracking * * @return array * (total, added, notAdded) count of contacts added to group diff --git a/CRM/Contact/BAO/Query/Hook.php b/CRM/Contact/BAO/Query/Hook.php index 4b020772be..d4ef2a38b4 100644 --- a/CRM/Contact/BAO/Query/Hook.php +++ b/CRM/Contact/BAO/Query/Hook.php @@ -37,7 +37,9 @@ class CRM_Contact_BAO_Query_Hook { /** - * @var array of CRM_Contact_BAO_Query_Interface objects + * Query objects. + * + * @var CRM_Contact_BAO_Query_Interface[] */ protected $_queryObjects = NULL; diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index 2fc3d2629d..909e321134 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -2252,7 +2252,7 @@ AND cc.sort_name LIKE '%$name%'"; * * @param array $params * @param int $relationshipId - * @param int|NULL $updatedRelTypeID + * @param int|null $updatedRelTypeID * * @return bool * TRUE if current employer needs to be cleared. diff --git a/CRM/Contact/Form/Search/Custom/FullText/AbstractPartialQuery.php b/CRM/Contact/Form/Search/Custom/FullText/AbstractPartialQuery.php index fc4dc667fc..7f35829238 100644 --- a/CRM/Contact/Form/Search/Custom/FullText/AbstractPartialQuery.php +++ b/CRM/Contact/Form/Search/Custom/FullText/AbstractPartialQuery.php @@ -85,9 +85,9 @@ abstract class CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery { * A temporary table into which we can write a list of all matching IDs. * @param string $detailTable * A table into which we can write details about a page worth of matches. - * @param array|NULL $queryLimit overall limit (applied when building $entityIDTableName) + * @param array|null $queryLimit overall limit (applied when building $entityIDTableName) * NULL if no limit; or array(0 => $limit, 1 => $offset) - * @param array|NULL $detailLimit final limit (applied when building $detailTable) + * @param array|null $detailLimit final limit (applied when building $detailTable) * NULL if no limit; or array(0 => $limit, 1 => $offset) * @return array * keys: match-descriptor diff --git a/CRM/Contact/Form/Task/AddToParentClass.php b/CRM/Contact/Form/Task/AddToParentClass.php index 3a1231f5b3..9dd59c403f 100644 --- a/CRM/Contact/Form/Task/AddToParentClass.php +++ b/CRM/Contact/Form/Task/AddToParentClass.php @@ -33,7 +33,7 @@ class CRM_Contact_Form_Task_AddToParentClass extends CRM_Contact_Form_Task { /** * Exported parameters from the form. * - * @var array. + * @var array */ protected $params; diff --git a/CRM/Contact/Import/Parser.php b/CRM/Contact/Import/Parser.php index 827eeff9fa..c8cfc0a84f 100644 --- a/CRM/Contact/Import/Parser.php +++ b/CRM/Contact/Import/Parser.php @@ -1347,7 +1347,9 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { * Input values * @param string $entity * - address, email, phone - * @param int|NULL $contactID + * @param int|null $contactID + * + * @throws \CiviCRM_API3_Exception */ protected function fillPrimary(&$params, $values, $entity, $contactID) { if ($values['location_type_id'] === 'Primary') { diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index ba2130a493..2b54981f9e 100644 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -458,7 +458,7 @@ FROM civicrm_action_schedule cas * @param Civi\ActionSchedule\Mapping $mapping * @param int $contactID * @param int $entityID - * @param int|NULL $caseID + * @param int|null $caseID * @throws CRM_Core_Exception */ protected static function createMailingActivity($tokenRow, $mapping, $contactID, $entityID, $caseID) { diff --git a/CRM/Core/BAO/Cache.php b/CRM/Core/BAO/Cache.php index 13d59a848b..15fc2e6de1 100644 --- a/CRM/Core/BAO/Cache.php +++ b/CRM/Core/BAO/Cache.php @@ -433,9 +433,9 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { * full access to DAO services. * * @param string $group - * @param string|NULL $path + * @param string|null $path * Filter by path. If NULL, then return any paths. - * @param int|NULL $componentID + * @param int|null $componentID * Filter by component. If NULL, then look for explicitly NULL records. * @return string */ diff --git a/CRM/Core/BAO/Note.php b/CRM/Core/BAO/Note.php index dabc8123bc..244ca4c25a 100644 --- a/CRM/Core/BAO/Note.php +++ b/CRM/Core/BAO/Note.php @@ -293,7 +293,7 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note { * @param bool $showStatus * Do we need to set status or not. * - * @return int|NULL + * @return int|null * no of deleted notes on success, null otherwise */ public static function del($id, $showStatus = TRUE) { diff --git a/CRM/Core/BAO/UFMatch.php b/CRM/Core/BAO/UFMatch.php index 39731cfa92..18ce81f8aa 100644 --- a/CRM/Core/BAO/UFMatch.php +++ b/CRM/Core/BAO/UFMatch.php @@ -482,7 +482,7 @@ AND domain_id = %4 * @param int $ufID * Id of UF for which related contact_id is required. * - * @return int|NULL + * @return int|null * contact_id on success, null otherwise */ public static function getContactId($ufID) { @@ -515,7 +515,7 @@ AND domain_id = %4 * @param int $contactID * ID of the contact for which related uf_id is required. * - * @return int|NULL + * @return int|null * uf_id of the given contact_id on success, null otherwise */ public static function getUFId($contactID) { diff --git a/CRM/Core/ClassLoader.php b/CRM/Core/ClassLoader.php index a87e8ea783..f951e578c7 100644 --- a/CRM/Core/ClassLoader.php +++ b/CRM/Core/ClassLoader.php @@ -63,11 +63,14 @@ class CRM_Core_ClassLoader { } /** - * @var bool TRUE if previously registered + * Has this been registered already. + * + * @var bool */ protected $_registered; /** + * Class constructor. */ protected function __construct() { $this->_registered = FALSE; diff --git a/CRM/Core/CommunityMessages.php b/CRM/Core/CommunityMessages.php index 6d660dc495..c15b13e129 100644 --- a/CRM/Core/CommunityMessages.php +++ b/CRM/Core/CommunityMessages.php @@ -50,7 +50,11 @@ class CRM_Core_CommunityMessages { protected $cache; /** - * @var FALSE|string + * Url to retrieve community messages from. + * + * False means a retrieval will not be attempted. + * + * @var false|string */ protected $messagesUrl; @@ -67,9 +71,11 @@ class CRM_Core_CommunityMessages { } /** + * Class constructor. + * * @param CRM_Utils_Cache_Interface $cache * @param CRM_Utils_HttpClient $client - * @param null $messagesUrl + * @param string|false $messagesUrl */ public function __construct($cache, $client, $messagesUrl = NULL) { $this->cache = $cache; @@ -86,7 +92,7 @@ class CRM_Core_CommunityMessages { } /** - * Get the messages document (either from the cache or by downloading) + * Get the messages document (either from the cache or by downloading). * * @return NULL|array */ diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index 51dda46d20..fc35186fe0 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -144,7 +144,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { /** * The destination if set will override the destination the code wants to send it to. * - * @var string; + * @var string */ public $_destination = NULL; @@ -170,6 +170,8 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * Should we add a unique sequence number to the end of the key. * @param bool $ignoreKey * Should we not set a qfKey for this controller (for standalone forms). + * + * @throws \CRM_Core_Exception */ public function __construct( $title = NULL, diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index 09295bf028..f4593a4bd5 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -2836,9 +2836,10 @@ SELECT contact_id /** * Transform an array to a serialized string for database storage. * - * @param array|NULL $value - * @param $serializationType - * @return string|NULL + * @param array|null $value + * @param int $serializationType + * @return string|null + * * @throws \Exception */ public static function serializeField($value, $serializationType) { diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index bc05679de0..2ed9b2362e 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -2133,7 +2133,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { /** * Get the contact id that the form is being submitted for. * - * @return int|NULL + * @return int|null */ public function getContactID() { return $this->setContactID(); diff --git a/CRM/Core/Form/Task/Batch.php b/CRM/Core/Form/Task/Batch.php index 9e56fe9292..2e86f420ff 100644 --- a/CRM/Core/Form/Task/Batch.php +++ b/CRM/Core/Form/Task/Batch.php @@ -49,7 +49,9 @@ class CRM_Core_Form_Task_Batch extends CRM_Core_Form_Task { protected $_maxFields = 9; /** - * @var array Fields that belong to this UF Group + * Fields that belong to this UF Group. + * + * @var array */ protected $_fields; diff --git a/CRM/Core/I18n.php b/CRM/Core/I18n.php index 217aec7397..a128119ed4 100644 --- a/CRM/Core/I18n.php +++ b/CRM/Core/I18n.php @@ -40,7 +40,7 @@ class CRM_Core_I18n { const NONE = 'none', AUTO = 'auto'; /** - * @var callable|NULL + * @var callable|null * A callback function which handles SQL string encoding. * Set NULL to use the default, CRM_Core_DAO::escapeString(). * This is used by `ts(..., [escape=>sql])`. @@ -419,8 +419,8 @@ class CRM_Core_I18n { * Lookup the raw translation of a string (without any extra escaping or interpolation). * * @param string $text - * @param string|NULL $domain - * @param int|NULL $count + * @param string|null $domain + * @param int|null $count * @param string $plural * @param string $context * diff --git a/CRM/Core/InnoDBIndexer.php b/CRM/Core/InnoDBIndexer.php index bdf45c9885..6060ddcc2a 100644 --- a/CRM/Core/InnoDBIndexer.php +++ b/CRM/Core/InnoDBIndexer.php @@ -101,9 +101,13 @@ class CRM_Core_InnoDBIndexer { } /** - * @var array (string $table => array $indices) + * Indices. + * + * (string $table => array $indices) * * ex: $indices['civicrm_contact'][0] = array('first_name', 'last_name'); + * + * @var array */ protected $indices; @@ -115,8 +119,8 @@ class CRM_Core_InnoDBIndexer { /** * Class constructor. * - * @param $isActive - * @param $indices + * @param bool $isActive + * @param array $indices */ public function __construct($isActive, $indices) { $this->isActive = $isActive; diff --git a/CRM/Core/JobManager.php b/CRM/Core/JobManager.php index d583a1c951..621c986192 100644 --- a/CRM/Core/JobManager.php +++ b/CRM/Core/JobManager.php @@ -35,7 +35,11 @@ class CRM_Core_JobManager { /** - * @var array ($id => CRM_Core_ScheduledJob) + * Jobs. + * + * Format is ($id => CRM_Core_ScheduledJob). + * + * @var array */ public $jobs = NULL; diff --git a/CRM/Core/Module.php b/CRM/Core/Module.php index f3976d1c8c..3a7da7a1e1 100644 --- a/CRM/Core/Module.php +++ b/CRM/Core/Module.php @@ -32,8 +32,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2019 - * $Id$ - * */ class CRM_Core_Module { @@ -43,13 +41,17 @@ class CRM_Core_Module { public $name; /** - * @var bool, TRUE if fully enabled; FALSE if module exists but is disabled + * Is the module enabled. + * + * @var bool */ public $is_active; /** + * Class constructor. + * * @param string $name - * @param $is_active + * @param bool $is_active */ public function __construct($name, $is_active) { $this->name = $name; diff --git a/CRM/Core/Page/AJAX.php b/CRM/Core/Page/AJAX.php index 2f11ee1c9d..7c2d1a00b7 100644 --- a/CRM/Core/Page/AJAX.php +++ b/CRM/Core/Page/AJAX.php @@ -198,7 +198,7 @@ class CRM_Core_Page_AJAX { /** * Set headers appropriate for a js file. * - * @param int|NULL $ttl + * @param int|null $ttl * Time-to-live (seconds). */ public static function setJsHeaders($ttl = NULL) { diff --git a/CRM/Core/Payment/PayPalProIPN.php b/CRM/Core/Payment/PayPalProIPN.php index d88f12de7d..be4da0c8fc 100644 --- a/CRM/Core/Payment/PayPalProIPN.php +++ b/CRM/Core/Payment/PayPalProIPN.php @@ -54,8 +54,11 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN { protected $_isPaymentExpress = FALSE; /** - * Are we dealing with an event an 'anything else' (contribute) - * @var string component + * Component. + * + * Are we dealing with an event an 'anything else' (contribute). + * + * @var string */ protected $_component = 'contribute'; diff --git a/CRM/Core/Payment/PaymentExpressIPN.php b/CRM/Core/Payment/PaymentExpressIPN.php index e3e5b0d1a0..81d2e5ff38 100644 --- a/CRM/Core/Payment/PaymentExpressIPN.php +++ b/CRM/Core/Payment/PaymentExpressIPN.php @@ -343,8 +343,8 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN { require_once 'PaymentExpress/pxaccess.inc.php'; global $pxaccess; $pxaccess = new PxAccess($dps_url, $dps_user, $dps_key, $mac_key); - #getResponse method in PxAccess object returns PxPayResponse object - #which encapsulates all the response data + // GetResponse method in PxAccess object returns PxPayResponse object + // which encapsulates all the response data $rsp = $pxaccess->getResponse($rawPostData); $qfKey = $rsp->getTxnData1(); diff --git a/CRM/Core/PrevNextCache/Interface.php b/CRM/Core/PrevNextCache/Interface.php index 6c355050e7..54048d26eb 100644 --- a/CRM/Core/PrevNextCache/Interface.php +++ b/CRM/Core/PrevNextCache/Interface.php @@ -67,7 +67,7 @@ interface CRM_Core_PrevNextCache_Interface { * @param string $cacheKey * @param string $action * Ex: 'select', 'unselect'. - * @param array|int|NULL $ids + * @param array|int|null $ids * A list of contact IDs to (un)select. * To unselect all contact IDs, use NULL. */ diff --git a/CRM/Core/PrevNextCache/Sql.php b/CRM/Core/PrevNextCache/Sql.php index 10fed3637e..3fed173b53 100644 --- a/CRM/Core/PrevNextCache/Sql.php +++ b/CRM/Core/PrevNextCache/Sql.php @@ -83,7 +83,7 @@ INSERT INTO civicrm_prevnext_cache (cacheKey, entity_id1, data) * @param string $cacheKey * @param string $action * Ex: 'select', 'unselect'. - * @param array|int|NULL $ids + * @param array|int|null $ids * A list of contact IDs to (un)select. * To unselect all contact IDs, use NULL. */ diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index 28984e107d..9950cf10f5 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -407,7 +407,7 @@ class CRM_Core_PseudoConstant { * * @param string $baoName * @param string $fieldName - * @param string|Int $key + * @param string|int $key * * TODO: Accept multivalued input? * @@ -429,7 +429,7 @@ class CRM_Core_PseudoConstant { * * @param string $baoName * @param string $fieldName - * @param string|Int $key + * @param string|int $key * * @return bool|null|string * FALSE if the given field has no associated option list @@ -449,7 +449,7 @@ class CRM_Core_PseudoConstant { * * @param string $baoName * @param string $fieldName - * @param string|Int $value + * @param string|int $value * * @return bool|null|string|int * FALSE if the given field has no associated option list diff --git a/CRM/Core/Reference/OptionValue.php b/CRM/Core/Reference/OptionValue.php index 94db035912..9f37cdf9fc 100644 --- a/CRM/Core/Reference/OptionValue.php +++ b/CRM/Core/Reference/OptionValue.php @@ -10,7 +10,9 @@ class CRM_Core_Reference_OptionValue extends CRM_Core_Reference_Basic { protected $targetOptionGroupName; /** - * @var int|NULL null if not yet loaded + * Target Option Group ID. + * + * @var int|null */ protected $targetOptionGroupId; @@ -45,6 +47,8 @@ class CRM_Core_Reference_OptionValue extends CRM_Core_Reference_Basic { } /** + * Get Reference Count. + * * @param CRM_Core_DAO $targetDao * * @return array|null @@ -63,7 +67,9 @@ class CRM_Core_Reference_OptionValue extends CRM_Core_Reference_Basic { } /** - * @return int|NULL + * Get target option group ID. + * + * @return int */ public function getTargetOptionGroupId() { if ($this->targetOptionGroupId === NULL) { diff --git a/CRM/Core/Region.php b/CRM/Core/Region.php index 6ece48f889..4fc96a074e 100644 --- a/CRM/Core/Region.php +++ b/CRM/Core/Region.php @@ -29,9 +29,11 @@ class CRM_Core_Region { public $_name; /** - * List of snippets to inject within region + * List of snippets to inject within region. * - * @var array; e.g. $this->_snippets[3]['type'] = 'template'; + * e.g. $this->_snippets[3]['type'] = 'template'; + * + * @var array */ public $_snippets; diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index 69f9e46150..3066d3331c 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -64,37 +64,55 @@ class CRM_Core_Resources { private $strings = NULL; /** - * @var array free-form data tree + * Settings in free-form data tree. + * + * @var array */ protected $settings = []; protected $addedSettings = FALSE; /** - * @var array of callables + * Setting factories. + * + * @var callable[] */ protected $settingsFactories = []; /** - * @var array ($regionName => bool) + * Added core resources. + * + * Format is ($regionName => bool). + * + * @var array */ protected $addedCoreResources = []; /** - * @var array ($regionName => bool) + * Added core styles. + * + * Format is ($regionName => bool). + * + * @var array */ protected $addedCoreStyles = []; /** - * @var string a value to append to JS/CSS URLs to coerce cache resets + * A value to append to JS/CSS URLs to coerce cache resets. + * + * @var string */ protected $cacheCode = NULL; /** - * @var string the name of a setting which persistently stores the cacheCode + * The name of a setting which persistently stores the cacheCode. + * + * @var string */ protected $cacheCodeKey = NULL; /** + * Are ajax popup screens enabled. + * * @var bool */ public $ajaxPopupsEnabled; @@ -109,6 +127,7 @@ class CRM_Core_Resources { * * @param CRM_Core_Resources $instance * New copy of the manager. + * * @return CRM_Core_Resources */ public static function singleton(CRM_Core_Resources $instance = NULL) { @@ -185,6 +204,7 @@ class CRM_Core_Resources { * - string: Load translated strings. Use a specific domain. * * @return CRM_Core_Resources + * @throws \Exception */ public function addScriptFile($ext, $file, $weight = self::DEFAULT_WEIGHT, $region = self::DEFAULT_REGION, $translate = TRUE) { if ($translate) { @@ -371,7 +391,7 @@ class CRM_Core_Resources { * And from javascript access it at CRM.myNamespace.myString * * @param string|array $text - * @param string|NULL $domain + * @param string|null $domain * @return CRM_Core_Resources */ public function addString($text, $domain = 'civicrm') { @@ -459,7 +479,7 @@ class CRM_Core_Resources { * * @param string $ext * extension name; use 'civicrm' for core. - * @param string|NULL $file + * @param string|null $file * file path -- relative to the extension base dir. * * @return bool|string diff --git a/CRM/Core/Resources/Strings.php b/CRM/Core/Resources/Strings.php index 451d02dda2..913483ba7d 100644 --- a/CRM/Core/Resources/Strings.php +++ b/CRM/Core/Resources/Strings.php @@ -30,12 +30,13 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2019 - * $Id$ */ class CRM_Core_Resources_Strings { /** - * @var CRM_Utils_Cache_Interface|NULL + * Cache. + * + * @var CRM_Utils_Cache_Interface|null */ private $cache = NULL; @@ -63,8 +64,11 @@ class CRM_Core_Resources_Strings { * File path. * @param string $format * Type of file (e.g. 'text/javascript', 'text/html'). + * * @return array * List of translatable strings. + * + * @throws \Exception */ public function get($bucket, $file, $format) { // array($file => array(...strings...)) diff --git a/CRM/Core/Session.php b/CRM/Core/Session.php index 8aa67bf9ca..982c63fa9c 100644 --- a/CRM/Core/Session.php +++ b/CRM/Core/Session.php @@ -539,7 +539,7 @@ class CRM_Core_Session { /** * Retrieve contact id of the logged in user. * - * @return int|NULL + * @return int|null * contact ID of logged in user */ public static function getLoggedInContactID() { diff --git a/CRM/Core/Smarty.php b/CRM/Core/Smarty.php index 06b05313e3..bea2363ddd 100644 --- a/CRM/Core/Smarty.php +++ b/CRM/Core/Smarty.php @@ -73,7 +73,11 @@ class CRM_Core_Smarty extends Smarty { static private $_singleton = NULL; /** - * @var array (string $name => mixed $value) a list of variables ot save temporarily + * Backup frames. + * + * A list of variables ot save temporarily in format (string $name => mixed $value). + * + * @var array */ private $backupFrames = []; diff --git a/CRM/Extension/Container/Collection.php b/CRM/Extension/Container/Collection.php index 0258c36896..b30d9498b0 100644 --- a/CRM/Extension/Container/Collection.php +++ b/CRM/Extension/Container/Collection.php @@ -37,14 +37,18 @@ class CRM_Extension_Container_Collection implements CRM_Extension_Container_Interface { /** - * @var array ($name => CRM_Extension_Container_Interface) + * Containers. + * + * Format is [$name => CRM_Extension_Container_Interface] + * + * @var [string => CRM_Extension_Container_Interface] * * Note: Treat as private. This is only public to facilitate debugging. */ public $containers; /** - * @var CRM_Utils_Cache_Interface|NULL + * @var CRM_Utils_Cache_Interface|null * * Note: Treat as private. This is only public to facilitate debugging. */ @@ -58,13 +62,19 @@ class CRM_Extension_Container_Collection implements CRM_Extension_Container_Inte public $cacheKey; /** - * @var array ($key => $containerName) + * K2C .... + * + * Format is ($key => $containerName). + * + * @var array * * Note: Treat as private. This is only public to facilitate debugging. */ public $k2c; /** + * Class constructor. + * * @param array $containers * Array($name => CRM_Extension_Container_Interface) in order from highest * priority (winners) to lowest priority (losers). @@ -95,7 +105,7 @@ class CRM_Extension_Container_Collection implements CRM_Extension_Container_Inte /** * @inheritDoc * - * @return array_keys + * @return array */ public function getKeys() { $k2c = $this->getKeysToContainer(); @@ -106,6 +116,8 @@ class CRM_Extension_Container_Collection implements CRM_Extension_Container_Inte * @inheritDoc * * @param string $key + * + * @throws \CRM_Extension_Exception_MissingException */ public function getPath($key) { return $this->getContainer($key)->getPath($key); @@ -115,6 +127,8 @@ class CRM_Extension_Container_Collection implements CRM_Extension_Container_Inte * @inheritDoc * * @param string $key + * + * @throws \CRM_Extension_Exception_MissingException */ public function getResUrl($key) { return $this->getContainer($key)->getResUrl($key); diff --git a/CRM/Extension/System.php b/CRM/Extension/System.php index 6aeaa30bae..b3157ffd57 100644 --- a/CRM/Extension/System.php +++ b/CRM/Extension/System.php @@ -51,7 +51,7 @@ class CRM_Extension_System { /** * The URL of the remote extensions repository. * - * @var string|FALSE + * @var string|false */ private $_repoUrl = NULL; @@ -89,6 +89,8 @@ class CRM_Extension_System { } /** + * Class constructor. + * * @param array $parameters * List of configuration values required by the extension system. * Missing values will be guessed based on $config. diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 4524376162..6119f19478 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -619,7 +619,7 @@ WHERE li.contribution_id = %1"; * @param float|NULL $overrideAmount * Optional override of the amount. * - * @param int|NULL $financialTypeID + * @param int|null $financialTypeID * Financial type ID is the type should be overridden. * * @return array diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index 69e1f7fcd6..c5b7caaad6 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -336,7 +336,7 @@ WHERE cpf.price_set_id = %1"; * array may contain either option id or * price field id * - * @return int|NULL + * @return int|null * price set id on success, null otherwise */ public static function getSetId(&$params) { diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php index 9a48148b9f..e2abd5a79f 100644 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@ -50,7 +50,12 @@ abstract class CRM_Utils_Hook { const SUMMARY_REPLACE = 3; /** - * @var ojbect + * Object to pass when an object is required to be passed by params. + * + * This is supposed to be a convenience but note that it is a bad + * pattern as it can get contaminated & result in hard-to-diagnose bugs. + * + * @var null */ public static $_nullObject = NULL; @@ -58,7 +63,7 @@ abstract class CRM_Utils_Hook { * We only need one instance of this object. So we use the singleton * pattern and cache the instance in this variable * - * @var object + * @var CRM_Utils_Hook */ static private $_singleton = NULL; @@ -82,7 +87,7 @@ abstract class CRM_Utils_Hook { * * @param bool $fresh * - * @return self + * @return CRM_Utils_Hook * An instance of $config->userHookClass */ public static function singleton($fresh = FALSE) { @@ -96,6 +101,8 @@ abstract class CRM_Utils_Hook { /** * CRM_Utils_Hook constructor. + * + * @throws \CRM_Core_Exception */ public function __construct() { $this->cache = CRM_Utils_Cache::create([ @@ -239,17 +246,20 @@ abstract class CRM_Utils_Hook { } /** - * @param $civiModules - * @param $fnSuffix - * @param array $numParams - * @param $arg1 - * @param $arg2 - * @param $arg3 - * @param $arg4 - * @param $arg5 - * @param $arg6 + * Run hooks. + * + * @param array $civiModules + * @param string $fnSuffix + * @param int $numParams + * @param mixed $arg1 + * @param mixed $arg2 + * @param mixed $arg3 + * @param mixed $arg4 + * @param mixed $arg5 + * @param mixed $arg6 * * @return array|bool + * @throws \Exception */ public function runHooks( $civiModules, $fnSuffix, $numParams, @@ -1879,7 +1889,7 @@ abstract class CRM_Utils_Hook { } /** - * @param CRM_Core_ExceptionObject $exception + * @param CRM_Core_Exception $exception * @param mixed $request * Reserved for future use. */ @@ -1891,7 +1901,7 @@ abstract class CRM_Utils_Hook { /** * This hook is called for declaring managed entities via API. * - * Note: This is a preboot hook. It will dispatch via the extension/module + * Note: This is a pre-boot hook. It will dispatch via the extension/module * subsystem but *not* the Symfony EventDispatcher. * * @param array[] $entityTypes @@ -2457,7 +2467,7 @@ abstract class CRM_Utils_Hook { /** * This hook is called before an inbound SMS is processed. * - * @param \CRM_SMS_MessageObject $message + * @param \CRM_SMS_Message $message * An SMS message received * @return mixed */ diff --git a/CRM/Utils/Hook/WordPress.php b/CRM/Utils/Hook/WordPress.php index ba032151ba..823803727b 100644 --- a/CRM/Utils/Hook/WordPress.php +++ b/CRM/Utils/Hook/WordPress.php @@ -38,22 +38,22 @@ class CRM_Utils_Hook_WordPress extends CRM_Utils_Hook { private $isBuilt = FALSE; /** - * @var array(string) + * @var string[] */ private $allModules = NULL; /** - * @var array(string) + * @var string[] */ private $civiModules = NULL; /** - * @var array(string) + * @var string[] */ private $wordpressModules = NULL; /** - * @var array(string) + * @var string[] */ private $hooksThatReturn = [ 'civicrm_upgrade', diff --git a/CRM/Utils/Http.php b/CRM/Utils/Http.php index 595a9c0607..71c58521f8 100644 --- a/CRM/Utils/Http.php +++ b/CRM/Utils/Http.php @@ -36,7 +36,7 @@ class CRM_Utils_Http { * Parse the expiration time from a series of HTTP headers. * * @param array $headers - * @return int|NULL + * @return int|null * Expiration tme as seconds since epoch, or NULL if not cacheable. */ public static function parseExpiration($headers) { diff --git a/CRM/Utils/HttpClient.php b/CRM/Utils/HttpClient.php index 65628ec3a6..776adafcaf 100644 --- a/CRM/Utils/HttpClient.php +++ b/CRM/Utils/HttpClient.php @@ -48,7 +48,7 @@ class CRM_Utils_HttpClient { protected static $singleton; /** - * @var int|NULL + * @var int|null * seconds; or NULL to use system default */ protected $connectionTimeout; diff --git a/CRM/Utils/System/Backdrop.php b/CRM/Utils/System/Backdrop.php index 9c22b6b86b..55804ddaac 100644 --- a/CRM/Utils/System/Backdrop.php +++ b/CRM/Utils/System/Backdrop.php @@ -487,7 +487,7 @@ AND u.status = 1 * Determine the native ID of the CMS user. * * @param string $username - * @return int|NULL + * @return int|null */ public function getUfId($username) { $user = user_load_by_name($username); diff --git a/CRM/Utils/System/Drupal.php b/CRM/Utils/System/Drupal.php index ade4ff8da0..4af4391244 100644 --- a/CRM/Utils/System/Drupal.php +++ b/CRM/Utils/System/Drupal.php @@ -428,7 +428,7 @@ AND u.status = 1 * Determine the native ID of the CMS user. * * @param string $username - * @return int|NULL + * @return int|null */ public function getUfId($username) { $user = user_load_by_name($username); diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index 402452fa38..9fc4813751 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -391,7 +391,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { * Determine the native ID of the CMS user. * * @param string $username - * @return int|NULL + * @return int|null */ public function getUfId($username) { $user = user_load(['name' => $username]); diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php index b832eee682..99b39389ad 100644 --- a/CRM/Utils/System/Drupal8.php +++ b/CRM/Utils/System/Drupal8.php @@ -372,7 +372,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase { * Determine the native ID of the CMS user. * * @param string $username - * @return int|NULL + * @return int|null */ public function getUfId($username) { if ($id = user_load_by_name($username)->id()) { diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index a1a9c64fd3..2a13781180 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -401,7 +401,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { * Determine the native ID of the CMS user. * * @param string $username - * @return int|NULL + * + * @return int|null */ public function getUfId($username) { $userdata = get_user_by('login', $username); diff --git a/Civi/API/Subscriber/DynamicFKAuthorization.php b/Civi/API/Subscriber/DynamicFKAuthorization.php index 647172cedd..94398ac0ca 100644 --- a/Civi/API/Subscriber/DynamicFKAuthorization.php +++ b/Civi/API/Subscriber/DynamicFKAuthorization.php @@ -200,7 +200,7 @@ class DynamicFKAuthorization implements EventSubscriberInterface { * The API action (e.g. "create"). * @param string $entityTable * The target entity table (e.g. "civicrm_mailing"). - * @param int|NULL $entityId + * @param int|null $entityId * The target entity ID. * @param array $apiRequest * The full API request. diff --git a/Civi/Core/Event/PostEvent.php b/Civi/Core/Event/PostEvent.php index fe69d3f98e..76b5eb4bdb 100644 --- a/Civi/Core/Event/PostEvent.php +++ b/Civi/Core/Event/PostEvent.php @@ -55,7 +55,7 @@ class PostEvent extends GenericHookEvent { public $entity; /** - * @var int|NULL + * @var int|null */ public $id; @@ -65,10 +65,12 @@ class PostEvent extends GenericHookEvent { public $object; /** - * @param $action - * @param $entity - * @param $id - * @param $object + * Class constructor + * + * @param string $action + * @param string $entity + * @param int $id + * @param object $object */ public function __construct($action, $entity, $id, &$object) { $this->action = $action; diff --git a/Civi/Core/Event/PreEvent.php b/Civi/Core/Event/PreEvent.php index 6332658a7b..844175b1b1 100644 --- a/Civi/Core/Event/PreEvent.php +++ b/Civi/Core/Event/PreEvent.php @@ -55,7 +55,7 @@ class PreEvent extends GenericHookEvent { public $entity; /** - * @var int|NULL + * @var int|null */ public $id; @@ -65,10 +65,12 @@ class PreEvent extends GenericHookEvent { public $params; /** - * @param $action - * @param $entity - * @param $id - * @param $params + * Class constructor. + * + * @param string $action + * @param string $entity + * @param int $id + * @param array $params */ public function __construct($action, $entity, $id, &$params) { $this->action = $action; diff --git a/Civi/Core/Lock/LockInterface.php b/Civi/Core/Lock/LockInterface.php index c84aa20f25..130f2ab908 100644 --- a/Civi/Core/Lock/LockInterface.php +++ b/Civi/Core/Lock/LockInterface.php @@ -34,7 +34,7 @@ interface LockInterface { /** * Acquire lock. * - * @param int|NULL $timeout + * @param int|null $timeout * The number of seconds to wait to get the lock. * For a default value, use NULL. * @return bool diff --git a/Civi/Core/Lock/LockManager.php b/Civi/Core/Lock/LockManager.php index 56b667664c..01727b6b8e 100644 --- a/Civi/Core/Lock/LockManager.php +++ b/Civi/Core/Lock/LockManager.php @@ -73,7 +73,7 @@ class LockManager { * * Categories: worker|data|cache|... * Component: core|mailing|member|contribute|... - * @param int|NULL $timeout + * @param int|null $timeout * The number of seconds to wait to get the lock. * For a default value, use NULL. * @return LockInterface diff --git a/Civi/Core/Lock/NullLock.php b/Civi/Core/Lock/NullLock.php index bdacbf8937..00e2a28bcc 100644 --- a/Civi/Core/Lock/NullLock.php +++ b/Civi/Core/Lock/NullLock.php @@ -49,7 +49,7 @@ class NullLock implements LockInterface { /** * Acquire lock. * - * @param int|NULL $timeout + * @param int|null $timeout * The number of seconds to wait to get the lock. * For a default value, use NULL. * diff --git a/Civi/Core/SettingsBag.php b/Civi/Core/SettingsBag.php index d2f742ad40..4155e7baf8 100644 --- a/Civi/Core/SettingsBag.php +++ b/Civi/Core/SettingsBag.php @@ -83,7 +83,7 @@ class SettingsBag { /** * @param int $domainId * The domain for which we want settings. - * @param int|NULL $contactId + * @param int|null $contactId * The contact for which we want settings. Use NULL for domain settings. */ public function __construct($domainId, $contactId) { diff --git a/Civi/Core/SettingsManager.php b/Civi/Core/SettingsManager.php index f887317467..45f8b46cb7 100644 --- a/Civi/Core/SettingsManager.php +++ b/Civi/Core/SettingsManager.php @@ -156,7 +156,10 @@ class SettingsManager { } /** - * @param int|NULL $domainId + * Get Settings by domain. + * + * @param int|null $domainId + * * @return SettingsBag */ public function getBagByDomain($domainId) { @@ -177,10 +180,13 @@ class SettingsManager { } /** - * @param int|NULL $domainId + * Get Settings by contact. + * + * @param int|null $domainId * For the default domain, leave $domainID as NULL. - * @param int|NULL $contactId + * @param int|null $contactId * For the default/active user's contact, leave $domainID as NULL. + * * @return SettingsBag * @throws \CRM_Core_Exception * If there is no contact, then there's no SettingsBag, and we'll throw diff --git a/api/v3/utils.php b/api/v3/utils.php index 1e5d383640..1a29319f7a 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -2153,7 +2153,8 @@ function _civicrm_api3_resolve_country_id($params) { * @param string $contactIdExpr * E.g. "user_contact_id" or "@user:username". * - * @return int|NULL|'unknown-user' + * @return int|null|'unknown-user' + * @throws \CRM_Core_Exception */ function _civicrm_api3_resolve_contactID($contactIdExpr) { // If value = 'user_contact_id' replace value with logged in user id.