(NFC) Bring CRM/Utils folder up to future coder standards
[civicrm-core.git] / CRM / Utils / Hook / UnitTests.php
index 5c3fb9f85db960545c0df63e58046c34ab2cb5ff..f5fa1400a913dc2234bccef2ec47e19998623a14 100644 (file)
@@ -35,7 +35,7 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook {
   protected $mockObject;
 
   /**
-   * @var array $adhocHooks to call
+   * @var array
    */
   protected $adhocHooks;
   protected $civiModules = NULL;
@@ -45,7 +45,7 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook {
    */
   public function reset() {
     $this->mockObject = NULL;
-    $this->adhocHooks = array();
+    $this->adhocHooks = [];
   }
 
   /**
@@ -104,14 +104,14 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook {
 
     // run standard hooks
     if ($this->civiModules === NULL) {
-      $this->civiModules = array();
+      $this->civiModules = [];
       $this->requireCiviModules($this->civiModules);
     }
     $fResult1 = $this->runHooks($this->civiModules, $fnSuffix, $numParams, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
 
     // run mock object hooks
-    if ($this->mockObject && is_callable(array($this->mockObject, $fnSuffix))) {
-      $fResult2 = call_user_func(array($this->mockObject, $fnSuffix), $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+    if ($this->mockObject && is_callable([$this->mockObject, $fnSuffix])) {
+      $fResult2 = call_user_func([$this->mockObject, $fnSuffix], $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
     }
 
     // run adhoc hooks
@@ -119,8 +119,8 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook {
       $fResult3 = call_user_func_array($this->adhocHooks[$fnSuffix], $params);
     }
 
-    $result = array();
-    foreach (array($fResult1, $fResult2, $fResult3) as $fResult) {
+    $result = [];
+    foreach ([$fResult1, $fResult2, $fResult3] as $fResult) {
       if (!empty($fResult) && is_array($fResult)) {
         $result = array_merge($result, $fResult);
       }