From 041ecc95479def1fd9dc7937116224d9e04b4249 Mon Sep 17 00:00:00 2001 From: eileen Date: Sun, 2 Jun 2019 11:48:20 +1200 Subject: [PATCH] PHPCS fixes. Improves compliance with drupal standard --- CRM/Case/XMLProcessor.php | 8 ++++-- CRM/Contact/BAO/Query.php | 4 ++- CRM/Contact/Form/Search/Custom/DateAdded.php | 2 +- CRM/Contact/Page/AJAX.php | 2 +- CRM/Core/BAO/Cache.php | 9 +++++-- CRM/Core/BAO/Mapping.php | 2 +- CRM/Core/BAO/OptionGroup.php | 2 +- CRM/Core/CodeGen/Main.php | 1 - CRM/Core/CodeGen/Specification.php | 2 +- CRM/Core/Payment/PayJunction.php | 2 +- CRM/Core/SelectValues.php | 6 +++-- CRM/Custom/Form/CustomData.php | 2 +- CRM/Cxn/CiviCxnHttp.php | 13 ++++++++-- CRM/Event/Form/Task/ParticipantStatus.php | 2 +- CRM/Export/BAO/ExportProcessor.php | 2 +- CRM/Extension/Container/Collection.php | 6 +++-- CRM/Extension/Manager.php | 22 ++++++++++++++--- CRM/Extension/Manager/Base.php | 4 ++- CRM/Queue/Service.php | 7 +++++- CRM/Report/Form/ActivitySummary.php | 2 +- CRM/Utils/Cache/SqlGroup.php | 10 ++++++-- CRM/Utils/Hook/DrupalBase.php | 26 ++++++++++++-------- CRM/Utils/QueryFormatter.php | 4 ++- 23 files changed, 99 insertions(+), 41 deletions(-) diff --git a/CRM/Case/XMLProcessor.php b/CRM/Case/XMLProcessor.php index d30b3cd06a..863ea68ff5 100644 --- a/CRM/Case/XMLProcessor.php +++ b/CRM/Case/XMLProcessor.php @@ -36,7 +36,9 @@ class CRM_Case_XMLProcessor { * FIXME: This does *NOT* belong in a static property, but we're too late in * the 4.5-cycle to do the necessary cleanup. * - * @var array|null array(int $id => string $relTypeCname) + * Format is [int $id => string $relTypeCname]. + * + * @var array|null */ public static $activityTypes = NULL; @@ -44,7 +46,9 @@ class CRM_Case_XMLProcessor { * FIXME: This does *NOT* belong in a static property, but we're too late in * the 4.5-cycle to do the necessary cleanup. * - * @var array|null array(int $id => string $relTypeCname) + * Format is array(int $id => string $relTypeCname). + * + * @var array|null */ public static $relationshipTypes = NULL; diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index e0c0bb867b..229a8de20f 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -436,7 +436,7 @@ class CRM_Contact_BAO_Query { * @param null $displayRelationshipType * @param string $operator * @param string $apiEntity - * @param bool|NULL $primaryLocationOnly + * @param bool|null $primaryLocationOnly */ public function __construct( $params = NULL, $returnProperties = NULL, $fields = NULL, @@ -6489,7 +6489,9 @@ AND displayRelType.is_active = 1 * @param string $where * @param string $from * + * * @return array + * @throws \CRM_Core_Exception */ protected function addBasicStatsToSummary(&$summary, $where, $from) { $summary['total']['count'] = 0; diff --git a/CRM/Contact/Form/Search/Custom/DateAdded.php b/CRM/Contact/Form/Search/Custom/DateAdded.php index 27c9546412..f3be4f2e2d 100644 --- a/CRM/Contact/Form/Search/Custom/DateAdded.php +++ b/CRM/Contact/Form/Search/Custom/DateAdded.php @@ -193,7 +193,7 @@ class CRM_Contact_Form_Search_Custom_DateAdded extends CRM_Contact_Form_Search_C $startDate = !empty($this->_formValues['start_date']) ? $this->_formValues['start_date'] : date('Y-m-d'); $endDateFix = NULL; if (!empty($this->_formValues['end_date'])) { - # tack 11:59pm on to make search inclusive of the end date + // tack 11:59pm on to make search inclusive of the end date $endDateFix = "AND date_added <= '{$this->_formValues['end_date']} 23:59:00'"; } diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index 97686838a9..299099a246 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -903,7 +903,7 @@ LIMIT {$offset}, {$rowCount} * * @param int $cid * @param int $oid - * @param 'dupe-nondupe'|'nondupe-dupe' $oper + * @param "dupe-nondupe|nondupe-dupe" $oper * * @return \CRM_Core_DAO|mixed|null */ diff --git a/CRM/Core/BAO/Cache.php b/CRM/Core/BAO/Cache.php index 15fc2e6de1..fe41bd06cc 100644 --- a/CRM/Core/BAO/Cache.php +++ b/CRM/Core/BAO/Cache.php @@ -43,13 +43,18 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { /** * When store session/form state, how long should the data be retained? * + * Default is Two days: 2*24*60*60 + * * @var int, number of second */ - // Two days: 2*24*60*60 const DEFAULT_SESSION_TTL = 172800; /** - * @var array ($cacheKey => $cacheValue) + * Cache. + * + * Format is ($cacheKey => $cacheValue) + * + * @var array */ public static $_cache = NULL; diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index 3a9e29f5e7..55e1ef9ae2 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -299,7 +299,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { * @param int $columnNo * @param int $blockCount * (no of blocks shown). - * @param NULL $exportMode + * @param int $exportMode */ public static function buildMappingForm(&$form, $mappingType, $mappingId, $columnNo, $blockCount, $exportMode = NULL) { diff --git a/CRM/Core/BAO/OptionGroup.php b/CRM/Core/BAO/OptionGroup.php index ca491c19fc..6cf6a90155 100644 --- a/CRM/Core/BAO/OptionGroup.php +++ b/CRM/Core/BAO/OptionGroup.php @@ -214,7 +214,7 @@ class CRM_Core_BAO_OptionGroup extends CRM_Core_DAO_OptionGroup { * * @param string $optionGroupName * e.g "languages" - * @param array $activeValues + * @param string[] $activeValues * e.g. array("en_CA","fr_CA") */ public static function setActiveValues($optionGroupName, $activeValues) { diff --git a/CRM/Core/CodeGen/Main.php b/CRM/Core/CodeGen/Main.php index 351ef233ef..4ea9ba8934 100644 --- a/CRM/Core/CodeGen/Main.php +++ b/CRM/Core/CodeGen/Main.php @@ -155,7 +155,6 @@ Alternatively you can get a version of CiviCRM that matches your PHP version if (!$this->database || !$this->tables) { $specification = new CRM_Core_CodeGen_Specification(); $specification->parse($this->schemaPath, $this->buildVersion); - # cheese: $this->database = $specification->database; $this->tables = $specification->tables; } diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php index 805cc733c4..9593c45148 100644 --- a/CRM/Core/CodeGen/Specification.php +++ b/CRM/Core/CodeGen/Specification.php @@ -32,7 +32,7 @@ class CRM_Core_CodeGen_Specification { $this->classNames = []; - # TODO: peel DAO-specific stuff out of getTables, and spec reading into its own class + // TODO: peel DAO-specific stuff out of getTables, and spec reading into its own class if ($verbose) { echo "Extracting table information\n"; } diff --git a/CRM/Core/Payment/PayJunction.php b/CRM/Core/Payment/PayJunction.php index 42eeb94d4a..646421ee03 100644 --- a/CRM/Core/Payment/PayJunction.php +++ b/CRM/Core/Payment/PayJunction.php @@ -19,7 +19,7 @@ require_once 'PayJunction/pjClasses.php'; * Class CRM_Core_Payment_PayJunction. */ class CRM_Core_Payment_PayJunction extends CRM_Core_Payment { - # (not used, implicit in the API, might need to convert?) + // (not used, implicit in the API, might need to convert?) const CHARSET = 'UFT-8'; /** diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 18af287821..7acab2d906 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -300,15 +300,17 @@ class CRM_Core_SelectValues { /** * Compose the parameters for a date select object. * - * @param string|NULL $type + * @param string|null $type * the type of date - * @param string|NULL $format + * @param string|null $format * date format (QF format) * @param null $minOffset * @param null $maxOffset * @param string $context + * * @return array * the date array + * @throws \Exception */ public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL, $context = 'display') { // These options are deprecated. Definitely not used in datepicker. Possibly not even in jcalendar+addDateTime. diff --git a/CRM/Custom/Form/CustomData.php b/CRM/Custom/Form/CustomData.php index 664d078cb2..42d6a5372a 100644 --- a/CRM/Custom/Form/CustomData.php +++ b/CRM/Custom/Form/CustomData.php @@ -192,7 +192,7 @@ class CRM_Custom_Form_CustomData { * * @param CRM_Core_Form $form * @param string $subType - * @param integer $gid + * @param int $gid * @param bool $onlySubType * @param bool $getCachedTree * diff --git a/CRM/Cxn/CiviCxnHttp.php b/CRM/Cxn/CiviCxnHttp.php index f8acdb9704..a972c7fd35 100644 --- a/CRM/Cxn/CiviCxnHttp.php +++ b/CRM/Cxn/CiviCxnHttp.php @@ -17,8 +17,12 @@ class CRM_Cxn_CiviCxnHttp extends \Civi\Cxn\Rpc\Http\PhpHttp { protected $cache; /** + * Singleton object. + * * @param bool $fresh + * * @return CRM_Cxn_CiviCxnHttp + * @throws \CRM_Core_Exception */ public static function singleton($fresh = FALSE) { if (self::$singleton === NULL || $fresh) { @@ -34,14 +38,17 @@ class CRM_Cxn_CiviCxnHttp extends \Civi\Cxn\Rpc\Http\PhpHttp { } /** - * @param CRM_Utils_Cache_Interface|NULL $cache - * The cache data store. + * The cache data store. + * + * @param CRM_Utils_Cache_Interface|null $cache */ public function __construct($cache) { $this->cache = $cache; } /** + * Send. + * * @param string $verb * @param string $url * @param string $blob @@ -107,6 +114,8 @@ class CRM_Cxn_CiviCxnHttp extends \Civi\Cxn\Rpc\Http\PhpHttp { } /** + * Get cache. + * * @return \CRM_Utils_Cache_Interface|null */ public function getCache() { diff --git a/CRM/Event/Form/Task/ParticipantStatus.php b/CRM/Event/Form/Task/ParticipantStatus.php index 64414a8fc7..7b97cc28c3 100644 --- a/CRM/Event/Form/Task/ParticipantStatus.php +++ b/CRM/Event/Form/Task/ParticipantStatus.php @@ -51,7 +51,7 @@ class CRM_Event_Form_Task_ParticipantStatus extends CRM_Event_Form_Task_Batch { ); $this->assign('context', 'statusChange'); - # CRM-4321: display info on users being notified if any of the below statuses is enabled + // CRM-4321: display info on users being notified if any of the below statuses is enabled parent::assignToTemplate(); parent::buildQuickForm(); } diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index 2e8513c831..8e2489172a 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -140,7 +140,7 @@ class CRM_Export_BAO_ExportProcessor { * CRM_Export_BAO_ExportProcessor constructor. * * @param int $exportMode - * @param array|NULL $requestedFields + * @param array|null $requestedFields * @param string $queryOperator * @param bool $isMergeSameHousehold * @param bool $isPostalableOnly diff --git a/CRM/Extension/Container/Collection.php b/CRM/Extension/Container/Collection.php index b30d9498b0..898361cc3e 100644 --- a/CRM/Extension/Container/Collection.php +++ b/CRM/Extension/Container/Collection.php @@ -41,7 +41,7 @@ class CRM_Extension_Container_Collection implements CRM_Extension_Container_Inte * * Format is [$name => CRM_Extension_Container_Interface] * - * @var [string => CRM_Extension_Container_Interface] + * @var array * * Note: Treat as private. This is only public to facilitate debugging. */ @@ -55,7 +55,9 @@ class CRM_Extension_Container_Collection implements CRM_Extension_Container_Inte public $cache; /** - * @var string the cache key used for any data stored by this container + * The cache key used for any data stored by this container. + * + * @var string * * Note: Treat as private. This is only public to facilitate debugging. */ diff --git a/CRM/Extension/Manager.php b/CRM/Extension/Manager.php index 7770d5a8e1..abc344c737 100644 --- a/CRM/Extension/Manager.php +++ b/CRM/Extension/Manager.php @@ -71,13 +71,17 @@ class CRM_Extension_Manager { public $fullContainer; /** - * @var CRM_Extension_Container_Basic|FALSE + * Default container. + * + * @var CRM_Extension_Container_Basic|false * * Note: Treat as private. This is only public to facilitate debugging. */ public $defaultContainer; /** + * Mapper. + * * @var CRM_Extension_Mapper * * Note: Treat as private. This is only public to facilitate debugging. @@ -85,24 +89,34 @@ class CRM_Extension_Manager { public $mapper; /** - * @var array (typeName => CRM_Extension_Manager_Interface) + * Type managers. + * + * @var array + * + * Format is (typeName => CRM_Extension_Manager_Interface) * * Note: Treat as private. This is only public to facilitate debugging. */ public $typeManagers; /** - * @var array (extensionKey => statusConstant) + * Statuses. + * + * @var array + * + * Format is (extensionKey => statusConstant) * * Note: Treat as private. This is only public to facilitate debugging. */ public $statuses; /** + * Class constructor. + * * @param CRM_Extension_Container_Interface $fullContainer * @param CRM_Extension_Container_Basic|FALSE $defaultContainer * @param CRM_Extension_Mapper $mapper - * @param $typeManagers + * @param array $typeManagers */ public function __construct(CRM_Extension_Container_Interface $fullContainer, $defaultContainer, CRM_Extension_Mapper $mapper, $typeManagers) { $this->fullContainer = $fullContainer; diff --git a/CRM/Extension/Manager/Base.php b/CRM/Extension/Manager/Base.php index 4fed2bc68e..b3fc0d9282 100644 --- a/CRM/Extension/Manager/Base.php +++ b/CRM/Extension/Manager/Base.php @@ -35,7 +35,9 @@ class CRM_Extension_Manager_Base implements CRM_Extension_Manager_Interface { /** - * @var bool hether to automatically uninstall and install during 'replace' + * Whether to automatically uninstall and install during 'replace'. + * + * @var bool */ public $autoReplace; diff --git a/CRM/Queue/Service.php b/CRM/Queue/Service.php index abb0738f85..d7dd024d39 100644 --- a/CRM/Queue/Service.php +++ b/CRM/Queue/Service.php @@ -70,11 +70,16 @@ class CRM_Queue_Service { } /** - * @var array (string $queueName => CRM_Queue_Queue) + * Queues. + * + * Format is (string $queueName => CRM_Queue_Queue). + * + * @var array */ public $queues; /** + * Class constructor. */ public function __construct() { $this->queues = []; diff --git a/CRM/Report/Form/ActivitySummary.php b/CRM/Report/Form/ActivitySummary.php index 110e0cfdfc..130326469d 100644 --- a/CRM/Report/Form/ActivitySummary.php +++ b/CRM/Report/Form/ActivitySummary.php @@ -358,7 +358,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { /** * Generate where clause. * - * @param bool|FALSE $durationMode + * @param bool $durationMode */ public function where($durationMode = FALSE) { $optionGroupClause = ''; diff --git a/CRM/Utils/Cache/SqlGroup.php b/CRM/Utils/Cache/SqlGroup.php index 19285de17f..6c0b6960ff 100644 --- a/CRM/Utils/Cache/SqlGroup.php +++ b/CRM/Utils/Cache/SqlGroup.php @@ -58,17 +58,23 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface { protected $componentID; /** - * @var array in-memory cache to optimize redundant get()s + * In-memory cache to optimize redundant get()s. + * + * @var array */ protected $valueCache; /** - * @var array in-memory cache to optimize redundant get()s + * In-memory cache to optimize redundant get()s. + * + * @var array * Note: expiresCache[$key]===NULL means cache-miss */ protected $expiresCache; /** + * Table. + * * @var string */ protected $table; diff --git a/CRM/Utils/Hook/DrupalBase.php b/CRM/Utils/Hook/DrupalBase.php index 8842e93437..832ca0bfcf 100644 --- a/CRM/Utils/Hook/DrupalBase.php +++ b/CRM/Utils/Hook/DrupalBase.php @@ -38,40 +38,46 @@ class CRM_Utils_Hook_DrupalBase extends CRM_Utils_Hook { private $isBuilt = FALSE; /** - * @var array(string) + * All Modules. + * + * @var string[] */ private $allModules = NULL; /** - * @var array(string) + * CiviCRM Modules. + * + * @var string[] */ private $civiModules = NULL; /** - * @var array(string) + * Drupal modules. + * + * @var string[] */ private $drupalModules = NULL; /** - * @see CRM_Utils_Hook::invoke() - * * @param int $numParams * Number of parameters to pass to the hook. - * @param unknown $arg1 + * @param mixed $arg1 * Parameter to be passed to the hook. - * @param unknown $arg2 + * @param mixed $arg2 * Parameter to be passed to the hook. - * @param unknown $arg3 + * @param mixed $arg3 * Parameter to be passed to the hook. - * @param unknown $arg4 + * @param mixed $arg4 * Parameter to be passed to the hook. - * @param unknown $arg5 + * @param mixed $arg5 * Parameter to be passed to the hook. * @param mixed $arg6 * @param string $fnSuffix * Function suffix, this is effectively the hook name. * * @return array|bool + * @throws \Exception + * @see CRM_Utils_Hook::invoke() */ public function invokeViaUF( $numParams, diff --git a/CRM/Utils/QueryFormatter.php b/CRM/Utils/QueryFormatter.php index 9c4b49ee59..d24ac1635c 100644 --- a/CRM/Utils/QueryFormatter.php +++ b/CRM/Utils/QueryFormatter.php @@ -89,7 +89,9 @@ class CRM_Utils_QueryFormatter { const MODE_WILDWORDS_SUFFIX = 'wildwords-suffix'; /** - * @var \CRM_Utils_QueryFormatter|NULL + * Singleton object. + * + * @var \CRM_Utils_QueryFormatter|null */ static protected $singleton; -- 2.25.1