From 4b350175e8ba50cdf4b2704fe37d1b67ac1c974e Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 14 Sep 2016 14:21:24 -0700 Subject: [PATCH] (NFC) CRM-17789 - Replace `@return $this` with types (more) The "phan" analyzer does not seem to understand `@return $this` correctly; instead, we should indicate a more specific return type. --- Civi/API/ExternalBatch.php | 2 +- Civi/API/SelectQuery.php | 2 +- Civi/ActionSchedule/Event/MappingRegisterEvent.php | 2 +- Civi/Core/Lock/LockManager.php | 2 +- Civi/Core/Paths.php | 2 +- Civi/Core/SettingsBag.php | 12 ++++++------ Civi/Core/SettingsManager.php | 6 +++--- Civi/Test/CiviEnvBuilder.php | 10 +++++----- Civi/Token/Event/TokenRegisterEvent.php | 2 +- Civi/Token/TokenProcessor.php | 4 ++-- Civi/Token/TokenRow.php | 8 ++++---- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Civi/API/ExternalBatch.php b/Civi/API/ExternalBatch.php index 1a2230077a..2e6507e669 100644 --- a/Civi/API/ExternalBatch.php +++ b/Civi/API/ExternalBatch.php @@ -58,7 +58,7 @@ class ExternalBatch { * @param string $entity * @param string $action * @param array $params - * @return $this + * @return ExternalBatch */ public function addCall($entity, $action, $params = array()) { $params = array_merge($this->defaultParams, $params); diff --git a/Civi/API/SelectQuery.php b/Civi/API/SelectQuery.php index fe50234416..c8332fe6d5 100644 --- a/Civi/API/SelectQuery.php +++ b/Civi/API/SelectQuery.php @@ -318,7 +318,7 @@ class SelectQuery { /** * @param \CRM_Utils_SQL_Select $sqlFragment - * @return $this + * @return SelectQuery */ public function merge($sqlFragment) { $this->query->merge($sqlFragment); diff --git a/Civi/ActionSchedule/Event/MappingRegisterEvent.php b/Civi/ActionSchedule/Event/MappingRegisterEvent.php index 7bd0d2899b..cd350bd075 100644 --- a/Civi/ActionSchedule/Event/MappingRegisterEvent.php +++ b/Civi/ActionSchedule/Event/MappingRegisterEvent.php @@ -23,7 +23,7 @@ class MappingRegisterEvent extends Event { * * @param MappingInterface $mapping * The new mapping. - * @return $this + * @return MappingRegisterEvent */ public function register(MappingInterface $mapping) { $this->mappings[$mapping->getId()] = $mapping; diff --git a/Civi/Core/Lock/LockManager.php b/Civi/Core/Lock/LockManager.php index ec85be7c40..9a2d532dbf 100644 --- a/Civi/Core/Lock/LockManager.php +++ b/Civi/Core/Lock/LockManager.php @@ -107,7 +107,7 @@ class LockManager { * @param string|array $factory * A callback. The callback should accept a $name parameter. * Callbacks will be located using the resolver. - * @return $this + * @return LockManager * @see Resolver */ public function register($pattern, $factory) { diff --git a/Civi/Core/Paths.php b/Civi/Core/Paths.php index f486dbfdb9..07b16f10a3 100644 --- a/Civi/Core/Paths.php +++ b/Civi/Core/Paths.php @@ -61,7 +61,7 @@ class Paths { * Function which returns an array with keys: * - path: string. * - url: string. - * @return $this + * @return Paths */ public function register($name, $factory) { $this->variableFactory[$name] = $factory; diff --git a/Civi/Core/SettingsBag.php b/Civi/Core/SettingsBag.php index c8904e8158..7b621e5e7a 100644 --- a/Civi/Core/SettingsBag.php +++ b/Civi/Core/SettingsBag.php @@ -98,7 +98,7 @@ class SettingsBag { * * @param array $defaults * Array(string $settingName => mixed $value). - * @return $this + * @return SettingsBag */ public function loadDefaults($defaults) { $this->defaults = $defaults; @@ -111,7 +111,7 @@ class SettingsBag { * * @param array $mandatory * Array(string $settingName => mixed $value). - * @return $this + * @return SettingsBag */ public function loadMandatory($mandatory) { $this->mandatory = $mandatory; @@ -122,7 +122,7 @@ class SettingsBag { /** * Load all explicit settings that apply to this domain or contact. * - * @return $this + * @return SettingsBag */ public function loadValues() { // Note: Don't use DAO child classes. They require fields() which require @@ -162,7 +162,7 @@ class SettingsBag { * * @param array $settings * Array(string $settingName => mixed $settingValue). - * @return $this + * @return SettingsBag */ public function add(array $settings) { foreach ($settings as $key => $value) { @@ -251,7 +251,7 @@ class SettingsBag { * * @param string $key * The simple name of the setting. - * @return $this + * @return SettingsBag */ public function revert($key) { // It might be better to DELETE (to avoid long-term leaks), @@ -266,7 +266,7 @@ class SettingsBag { * The simple name of the setting. * @param mixed $value * The new, explicit value of the setting. - * @return $this + * @return SettingsBag */ public function set($key, $value) { $this->setDb($key, $value); diff --git a/Civi/Core/SettingsManager.php b/Civi/Core/SettingsManager.php index acbf79db27..0194d2e495 100644 --- a/Civi/Core/SettingsManager.php +++ b/Civi/Core/SettingsManager.php @@ -99,7 +99,7 @@ class SettingsManager { * Ensure that all defaults values are included with * all current and future bags. * - * @return $this + * @return SettingsManager */ public function useDefaults() { if (!$this->useDefaults) { @@ -130,7 +130,7 @@ class SettingsManager { * If you call useMandatory multiple times, it will * re-scan the global $civicrm_setting. * - * @return $this + * @return SettingsManager */ public function useMandatory() { $this->mandatory = NULL; @@ -293,7 +293,7 @@ class SettingsManager { /** * Flush all in-memory and persistent caches related to settings. * - * @return $this + * @return SettingsManager */ public function flush() { $this->mandatory = NULL; diff --git a/Civi/Test/CiviEnvBuilder.php b/Civi/Test/CiviEnvBuilder.php index fe5d0e6e0c..003e14545d 100644 --- a/Civi/Test/CiviEnvBuilder.php +++ b/Civi/Test/CiviEnvBuilder.php @@ -54,7 +54,7 @@ class CiviEnvBuilder { * * @param string|array $names * One or more extension names. You may use a wildcard '*'. - * @return $this + * @return CiviEnvBuilder */ public function install($names) { return $this->addStep(new ExtensionsStep('install', $names)); @@ -66,7 +66,7 @@ class CiviEnvBuilder { * @param string $dir * The current test directory. We'll search for info.xml to * see what this extension is. - * @return $this + * @return CiviEnvBuilder * @throws \CRM_Extension_Exception_ParseException */ public function installMe($dir) { @@ -78,7 +78,7 @@ class CiviEnvBuilder { * * @param string|array $names * One or more extension names. You may use a wildcard '*'. - * @return $this + * @return CiviEnvBuilder */ public function uninstall($names) { return $this->addStep(new ExtensionsStep('uninstall', $names)); @@ -90,7 +90,7 @@ class CiviEnvBuilder { * @param string $dir * The current test directory. We'll search for info.xml to * see what this extension is. - * @return $this + * @return CiviEnvBuilder * @throws \CRM_Extension_Exception_ParseException */ public function uninstallMe($dir) { @@ -165,7 +165,7 @@ class CiviEnvBuilder { * Forcibly execute the build, even if the configuration hasn't changed. * This will slow-down the tests, but it may be appropriate for some very sloppy * tests. - * @return $this + * @return CiviEnvBuilder */ public function apply($force = FALSE) { $dbName = \Civi\Test::dsn('database'); diff --git a/Civi/Token/Event/TokenRegisterEvent.php b/Civi/Token/Event/TokenRegisterEvent.php index 067f7e49cc..ff9122543c 100644 --- a/Civi/Token/Event/TokenRegisterEvent.php +++ b/Civi/Token/Event/TokenRegisterEvent.php @@ -50,7 +50,7 @@ class TokenRegisterEvent extends TokenEvent { * * @param array|string $paramsOrField * @param NULL|string $label - * @return $this + * @return TokenRegisterEvent */ public function register($paramsOrField, $label = NULL) { if (is_array($paramsOrField)) { diff --git a/Civi/Token/TokenProcessor.php b/Civi/Token/TokenProcessor.php index b373a80686..99a0f0f9c4 100644 --- a/Civi/Token/TokenProcessor.php +++ b/Civi/Token/TokenProcessor.php @@ -88,7 +88,7 @@ class TokenProcessor { * Ex: '

Hello {contact.name}

'. * @param string $format * Ex: 'text/html'. - * @return $this + * @return TokenProcessor */ public function addMessage($name, $value, $format) { $this->messages[$name] = array( @@ -121,7 +121,7 @@ class TokenProcessor { * - entity: string, e.g. "profile". * - field: string, e.g. "viewUrl". * - label: string, e.g. "Default Profile URL (View Mode)". - * @return $this + * @return TokenProcessor */ public function addToken($params) { $key = $params['entity'] . '.' . $params['field']; diff --git a/Civi/Token/TokenRow.php b/Civi/Token/TokenRow.php index 439a138cdb..a18a81c435 100644 --- a/Civi/Token/TokenRow.php +++ b/Civi/Token/TokenRow.php @@ -71,7 +71,7 @@ class TokenRow { /** * @param string $format - * @return $this + * @return TokenRow */ public function format($format) { $this->format = $format; @@ -84,7 +84,7 @@ class TokenRow { * * @param string|array $a * @param mixed $b - * @return $this + * @return TokenRow */ public function context($a = NULL, $b = NULL) { if (is_array($a)) { @@ -105,7 +105,7 @@ class TokenRow { * @param string|array $a * @param string|array $b * @param mixed $c - * @return $this + * @return TokenRow */ public function tokens($a = NULL, $b = NULL, $c = NULL) { if (is_array($a)) { @@ -171,7 +171,7 @@ class TokenRow { * * @param string $format * - * @return $this + * @return TokenRow */ public function fill($format = NULL) { if ($format === NULL) { -- 2.25.1