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.
*
* @param bool $changeClient
*
- * @return int|NULL
+ * @return int|null
+ * @throws \CRM_Core_Exception
*/
public static function mergeCases(
$mainContactId, $mainCaseId = NULL, $otherContactId = NULL,
* 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) {
* @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);
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;
* @param string $greetingType
* Greeting type.
*
- * @return int|NULL
+ * @return int|null
*/
public static function defaultGreeting($contactType, $greetingType) {
$contactTypeFilters = [
* @param array $groupIDs
* Array of group ids.
*
- * @param NULL $parents
+ * @param string $parents
* @param string $spacer
* @param bool $titleOnly
*
*
* @param string $method
* @param string $status
- * @param NULL $tracking
+ * @param string $tracking
*
* @return array
* (total, removed, notRemoved) count of contacts removed to group
* 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
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;
*
* @param array $params
* @param int $relationshipId
- * @param int|NULL $updatedRelTypeID
+ * @param int|null $updatedRelTypeID
*
* @return bool
* TRUE if current employer needs to be cleared.
* 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
/**
* Exported parameters from the form.
*
- * @var array.
+ * @var array
*/
protected $params;
* 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') {
* @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) {
* 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
*/
* @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) {
* @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) {
* @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) {
}
/**
- * @var bool TRUE if previously registered
+ * Has this been registered already.
+ *
+ * @var bool
*/
protected $_registered;
/**
+ * Class constructor.
*/
protected function __construct() {
$this->_registered = FALSE;
protected $cache;
/**
- * @var FALSE|string
+ * Url to retrieve community messages from.
+ *
+ * False means a retrieval will not be attempted.
+ *
+ * @var false|string
*/
protected $messagesUrl;
}
/**
+ * 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;
}
/**
- * 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
*/
/**
* The destination if set will override the destination the code wants to send it to.
*
- * @var string;
+ * @var string
*/
public $_destination = NULL;
* 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,
/**
* 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) {
/**
* Get the contact id that the form is being submitted for.
*
- * @return int|NULL
+ * @return int|null
*/
public function getContactID() {
return $this->setContactID();
protected $_maxFields = 9;
/**
- * @var array Fields that belong to this UF Group
+ * Fields that belong to this UF Group.
+ *
+ * @var array
*/
protected $_fields;
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])`.
* 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
*
}
/**
- * @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;
/**
* Class constructor.
*
- * @param $isActive
- * @param $indices
+ * @param bool $isActive
+ * @param array $indices
*/
public function __construct($isActive, $indices) {
$this->isActive = $isActive;
class CRM_Core_JobManager {
/**
- * @var array ($id => CRM_Core_ScheduledJob)
+ * Jobs.
+ *
+ * Format is ($id => CRM_Core_ScheduledJob).
+ *
+ * @var array
*/
public $jobs = NULL;
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2019
- * $Id$
- *
*/
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;
/**
* 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) {
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';
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();
* @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.
*/
* @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.
*/
*
* @param string $baoName
* @param string $fieldName
- * @param string|Int $key
+ * @param string|int $key
*
* TODO: Accept multivalued input?
*
*
* @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
*
* @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
protected $targetOptionGroupName;
/**
- * @var int|NULL null if not yet loaded
+ * Target Option Group ID.
+ *
+ * @var int|null
*/
protected $targetOptionGroupId;
}
/**
+ * Get Reference Count.
+ *
* @param CRM_Core_DAO $targetDao
*
* @return array|null
}
/**
- * @return int|NULL
+ * Get target option group ID.
+ *
+ * @return int
*/
public function getTargetOptionGroupId() {
if ($this->targetOptionGroupId === NULL) {
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;
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;
*
* @param CRM_Core_Resources $instance
* New copy of the manager.
+ *
* @return CRM_Core_Resources
*/
public static function singleton(CRM_Core_Resources $instance = NULL) {
* - 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) {
* 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') {
*
* @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
*
* @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;
* 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...))
/**
* Retrieve contact id of the logged in user.
*
- * @return int|NULL
+ * @return int|null
* contact ID of logged in user
*/
public static function getLoggedInContactID() {
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 = [];
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.
*/
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).
/**
* @inheritDoc
*
- * @return array_keys
+ * @return array
*/
public function getKeys() {
$k2c = $this->getKeysToContainer();
* @inheritDoc
*
* @param string $key
+ *
+ * @throws \CRM_Extension_Exception_MissingException
*/
public function getPath($key) {
return $this->getContainer($key)->getPath($key);
* @inheritDoc
*
* @param string $key
+ *
+ * @throws \CRM_Extension_Exception_MissingException
*/
public function getResUrl($key) {
return $this->getContainer($key)->getResUrl($key);
/**
* The URL of the remote extensions repository.
*
- * @var string|FALSE
+ * @var string|false
*/
private $_repoUrl = NULL;
}
/**
+ * Class constructor.
+ *
* @param array $parameters
* List of configuration values required by the extension system.
* Missing values will be guessed based on $config.
* @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
* 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) {
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;
* 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;
*
* @param bool $fresh
*
- * @return self
+ * @return CRM_Utils_Hook
* An instance of $config->userHookClass
*/
public static function singleton($fresh = FALSE) {
/**
* CRM_Utils_Hook constructor.
+ *
+ * @throws \CRM_Core_Exception
*/
public function __construct() {
$this->cache = CRM_Utils_Cache::create([
}
/**
- * @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,
}
/**
- * @param CRM_Core_ExceptionObject $exception
+ * @param CRM_Core_Exception $exception
* @param mixed $request
* Reserved for future use.
*/
/**
* 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
/**
* 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
*/
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',
* 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) {
protected static $singleton;
/**
- * @var int|NULL
+ * @var int|null
* seconds; or NULL to use system default
*/
protected $connectionTimeout;
* 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);
* 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);
* 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]);
* 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()) {
* 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);
* 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.
public $entity;
/**
- * @var int|NULL
+ * @var int|null
*/
public $id;
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;
public $entity;
/**
- * @var int|NULL
+ * @var int|null
*/
public $id;
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;
/**
* 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
*
* 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
/**
* 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.
*
/**
* @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) {
}
/**
- * @param int|NULL $domainId
+ * Get Settings by domain.
+ *
+ * @param int|null $domainId
+ *
* @return SettingsBag
*/
public function getBagByDomain($domainId) {
}
/**
- * @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
* @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.