Cleanup phpdoc comments
[civicrm-core.git] / CRM / Utils / Hook.php
index e16be4805bb3e12541363e82fc76d866f79fbea0..fa8b6be2d3114f3ac0df47b2f6884a0d4496cbaa 100644 (file)
@@ -109,7 +109,7 @@ abstract class CRM_Utils_Hook {
   );
 
   /**
-   * @param $numParams
+   * @param array $numParams
    * @param $arg1
    * @param $arg2
    * @param $arg3
@@ -161,7 +161,7 @@ abstract class CRM_Utils_Hook {
   /**
    * @param $civiModules
    * @param $fnSuffix
-   * @param $numParams
+   * @param array $numParams
    * @param $arg1
    * @param $arg2
    * @param $arg3
@@ -178,12 +178,13 @@ abstract class CRM_Utils_Hook {
     // must be reentrant. PHP is finicky about running
     // multiple loops over the same variable. The circumstances
     // to reproduce the issue are pretty intricate.
-    $result = $fResult = array();
+    $result = array();
 
     if ($civiModules !== NULL) {
       foreach ($civiModules as $module) {
         $fnName = "{$module}_{$fnSuffix}";
         if (function_exists($fnName)) {
+          $fResult = array();
           switch ($numParams) {
             case 0:
               $fResult = $fnName();
@@ -217,11 +218,11 @@ abstract class CRM_Utils_Hook {
               CRM_Core_Error::fatal(ts('Invalid hook invocation'));
               break;
           }
-        }
 
-        if (!empty($fResult) &&
-          is_array($fResult)) {
-          $result = array_merge($result, $fResult);
+          if (!empty($fResult) &&
+            is_array($fResult)) {
+            $result = array_merge($result, $fResult);
+          }
         }
       }
     }
@@ -253,7 +254,7 @@ abstract class CRM_Utils_Hook {
    *
    * @param string $op         the type of operation being performed
    * @param string $objectName the name of the object
-   * @param object $id         the object id if available
+   * @param int $id         the object id if available
    * @param array  $params     the parameters used for object creation / editing
    *
    * @return null the return value is ignored
@@ -301,12 +302,24 @@ abstract class CRM_Utils_Hook {
     return self::singleton()->invoke(6, $op, $objectName, $objectId, $links, $mask, $values, 'civicrm_links');
   }
 
+  /**
+   * This hook is invoked during the CiviCRM form preProcess phase.
+   *
+   * @param string $formName the name of the form
+   * @param CRM_Core_Form $form     reference to the form object
+   *
+   * @return null the return value is ignored
+   */
+  static function preProcess($formName, &$form) {
+    return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_preProcess');
+  }
+
   /**
    * This hook is invoked when building a CiviCRM form. This hook should also
    * be used to set the default values of a form element
    *
    * @param string $formName the name of the form
-   * @param object $form     reference to the form object
+   * @param CRM_Core_Form $form     reference to the form object
    *
    * @return null the return value is ignored
    */
@@ -319,7 +332,7 @@ abstract class CRM_Utils_Hook {
    * any form elements, this hook should save the values in the database
    *
    * @param string $formName the name of the form
-   * @param object $form     reference to the form object
+   * @param CRM_Core_Form $form     reference to the form object
    *
    * @return null the return value is ignored
    */
@@ -499,7 +512,7 @@ abstract class CRM_Utils_Hook {
    * This hook is called when building the amount structure for a Contribution or Event Page
    *
    * @param int    $pageType - is this a contribution or event page
-   * @param object $form     - reference to the form object
+   * @param CRM_Core_Form $form     - reference to the form object
    * @param array  $amount   - the amount structure to be displayed
    *
    * @return null
@@ -908,7 +921,7 @@ abstract class CRM_Utils_Hook {
 
   /**
    * @param $recordBAO
-   * @param $recordID
+   * @param int $recordID
    * @param $isActive
    *
    * @return mixed
@@ -1064,10 +1077,9 @@ abstract class CRM_Utils_Hook {
    * @param string $entity the API entity (like contact)
    * @param string $action the API action (like get)
    * @param array &$params the API parameters
-   * @param $permissions
+   * @param array &$permissions the associative permissions array (probably to be altered by this hook)
    *
    * @return mixed
-   * @internal param array $permisisons the associative permissions array (probably to be altered by this hook)
    */
   static function alterAPIPermissions($entity, $action, &$params, &$permissions) {
     return self::singleton()->invoke(4, $entity, $action, $params, $permissions,
@@ -1077,7 +1089,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * @param $dao
+   * @param CRM_Core_DAO $dao
    *
    * @return mixed
    */
@@ -1622,7 +1634,7 @@ abstract class CRM_Utils_Hook {
    * @return void
    */
   static function pre_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
-    return self::singleton()->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, 'civicrm_pre_case_merge');
+    return self::singleton()->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_pre_case_merge');
   }
 
   /**
@@ -1637,7 +1649,7 @@ abstract class CRM_Utils_Hook {
    * @return void
    */
   static function post_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
-    return self::singleton()->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, 'civicrm_post_case_merge');
+    return self::singleton()->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_post_case_merge');
   }
 
   /**
@@ -1717,4 +1729,15 @@ abstract class CRM_Utils_Hook {
       'civicrm_crudLink'
     );
   }
+
+  /**
+   * @param array<CRM_Core_FileSearchInterface> $fileSearches
+   * @return mixed
+   */
+  static function fileSearches(&$fileSearches) {
+    return self::singleton()->invoke(1, $fileSearches,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_fileSearches'
+    );
+  }
 }