Test - Convert arrays to short syntax
authorcolemanw <coleman@civicrm.org>
Mon, 2 Oct 2023 19:08:26 +0000 (15:08 -0400)
committercolemanw <coleman@civicrm.org>
Mon, 2 Oct 2023 19:08:26 +0000 (15:08 -0400)
16 files changed:
tests/phpunit/CRM/Case/BAO/CaseTest.php
tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php
tests/phpunit/CRM/Contribute/Form/Task/PDFLetterCommonTest.php
tests/phpunit/CRM/Mailing/MailingSystemTest.php
tests/phpunit/CRM/Utils/FileTest.php
tests/phpunit/CiviTest/CiviCaseTestCase.php
tests/phpunit/CiviTest/CiviEndToEndTestCase.php
tests/phpunit/CiviTest/CiviMailUtils.php
tests/phpunit/CiviTest/CiviReportTestCase.php
tests/phpunit/CiviTest/CiviTestSMSProvider.php
tests/phpunit/CiviTest/bootstrap.php
tests/phpunit/E2E/Cache/CacheTestCase.php
tests/phpunit/E2E/Cache/TwoInstancesTest.php
tests/phpunit/E2E/Core/AssetBuilderTest.php
tests/phpunit/E2E/Core/PrevNextTest.php
tests/phpunit/E2E/Extern/BaseRestTest.php

index 40a3ab39aa8f11f442e19eb87b60246a0518dc37..0dd3ce1ee24abe450440f5d10b28adb25fed1d67 100644 (file)
@@ -275,28 +275,28 @@ class CRM_Case_BAO_CaseTest extends CiviUnitTestCase {
    */
   public function testCaseReassignForCustomFiles(): void {
     $individual = $this->individualCreate();
-    $customGroup = $this->customGroupCreate(array(
+    $customGroup = $this->customGroupCreate([
       'extends' => 'Case',
-    ));
+    ]);
     $customGroup = $customGroup['values'][$customGroup['id']];
 
-    $customFileFieldA = $this->customFieldCreate(array(
+    $customFileFieldA = $this->customFieldCreate([
       'custom_group_id' => $customGroup['id'],
       'html_type'       => 'File',
       'is_active'       => 1,
       'default_value'   => 'null',
       'label'           => 'Custom File A',
       'data_type'       => 'File',
-    ));
+    ]);
 
-    $customFileFieldB = $this->customFieldCreate(array(
+    $customFileFieldB = $this->customFieldCreate([
       'custom_group_id' => $customGroup['id'],
       'html_type'       => 'File',
       'is_active'       => 1,
       'default_value'   => 'null',
       'label'           => 'Custom File B',
       'data_type'       => 'File',
-    ));
+    ]);
 
     // Create two files to attach to the new case
     $filepath = Civi::paths()->getPath('[civicrm.files]/custom');
@@ -309,11 +309,11 @@ class CRM_Case_BAO_CaseTest extends CiviUnitTestCase {
 
     $caseObj = $this->createCase($individual);
 
-    $this->callAPISuccess('Case', 'create', array(
+    $this->callAPISuccess('Case', 'create', [
       'id'                                => $caseObj->id,
       'custom_' . $customFileFieldA['id'] => $fileA['id'],
       'custom_' . $customFileFieldB['id'] => $fileB['id'],
-    ));
+    ]);
 
     $reassignIndividual = $this->individualCreate();
     $this->createLoggedInUser();
index 12060880828ad14218579e1256f50a44c9aa7e93..76f0dd7ede5fd2d1c3df3c427f95e90abbf63425 100644 (file)
@@ -289,7 +289,7 @@ class CRM_Contribute_BAO_ContributionRecurTest extends CiviUnitTestCase {
     ]);
 
     // Register "contribution create" hook
-    $this->hookClass->setHook('civicrm_post', array($this, 'implementHookPost'));
+    $this->hookClass->setHook('civicrm_post', [$this, 'implementHookPost']);
     \Civi::$statics['testCreateTemplateContributionFromFirstContributionTest']['custom_field_id'] = $custom_field['id'];
 
     // Make sure a template contribution exists.
index 547eaa1b24549b522255696c59f35263195e0191..08d463637ec0325865ecc0d97ced662b68f3255c 100644 (file)
@@ -41,7 +41,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommonTest extends CiviUnitTestCase {
     $this->_docTypes = CRM_Core_SelectValues::documentApplicationType();
     $hooks = \CRM_Utils_Hook::singleton();
     $hooks->setHook('civicrm_alterMailParams',
-      array($this, 'hook_alterMailParams'));
+      [$this, 'hook_alterMailParams']);
   }
 
   /**
index 20d7bd08c4eab7e04bbefd25cb683a1a133bf6ca..280ee6e0acd21f22a5c43596acfecbd06e774bd9 100644 (file)
@@ -187,8 +187,8 @@ class CRM_Mailing_MailingSystemTest extends CRM_Mailing_BaseMailingSystemTest {
 
     // The following code is exactly the same as runMailingSuccess() except that we store the ID of the mailing.
     $mailing_1 = $this->callAPISuccess('Mailing', 'create', $mailingParams);
-    $mut->assertRecipients(array());
-    $this->callAPISuccess('job', 'process_mailing', array('runInNonProductionEnvironment' => TRUE));
+    $mut->assertRecipients([]);
+    $this->callAPISuccess('job', 'process_mailing', ['runInNonProductionEnvironment' => TRUE]);
 
     $allMessages = $mut->getAllMessages('ezc');
     $this->assertCount(1, $allMessages);
@@ -300,8 +300,8 @@ class CRM_Mailing_MailingSystemTest extends CRM_Mailing_BaseMailingSystemTest {
 
     // The following code is exactly the same as runMailingSuccess() except that we store the ID of the mailing.
     $mailing_1 = $this->callAPISuccess('mailing', 'create', $mailingParams);
-    $mut->assertRecipients(array());
-    $this->callAPISuccess('job', 'process_mailing', array('runInNonProductionEnvironment' => TRUE));
+    $mut->assertRecipients([]);
+    $this->callAPISuccess('job', 'process_mailing', ['runInNonProductionEnvironment' => TRUE]);
 
     $allMessages = $mut->getAllMessages('ezc');
     // There are exactly two contacts produced by setUp().
@@ -325,7 +325,7 @@ class CRM_Mailing_MailingSystemTest extends CRM_Mailing_BaseMailingSystemTest {
       'body_text'      => 'Please just {action.unsubscribeUrl}',
     ];
     $this->callAPISuccess('mailing', 'create', $mailingParams);
-    $_ = $this->callAPISuccess('job', 'process_mailing', array('runInNonProductionEnvironment' => TRUE));
+    $_ = $this->callAPISuccess('job', 'process_mailing', ['runInNonProductionEnvironment' => TRUE]);
 
     $allMessages = $mut->getAllMessages('ezc');
     // We should have 2+2 messages sent by the mail system now.
index f514b70b0972bcae66e7226c745f183abb0e302f..973f5c0bbf349c1621fdaf3ef23bfd9cbbe9bb74 100644 (file)
@@ -429,7 +429,7 @@ class CRM_Utils_FileTest extends CiviUnitTestCase {
 
     try {
       $cmd = 'cv ev -v ' . escapeshellarg("return require \"$outFile\";");
-      $descriptorSpec = array(0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']);
+      $descriptorSpec = [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']];
       $oldOutput = getenv('CV_OUTPUT');
       putenv("CV_OUTPUT=json");
       $process = proc_open($cmd, $descriptorSpec, $pipes, __DIR__);
index 0d1f615d917cfeddde67e15cccb3a08d59c0886b..5b35bd62025dd6b35e78d62b196f3dd1f6294da5 100644 (file)
@@ -39,10 +39,10 @@ class CiviCaseTestCase extends CiviUnitTestCase {
     //. Using XML was causing breakage as id numbers were changing over time
     // & was really hard to troubleshoot as involved truncating option_value table to mitigate this & not leaving DB in a
     // state where tests could run afterwards without re-loading.
-    $this->caseStatusGroup = $this->callAPISuccess('option_group', 'get', array(
+    $this->caseStatusGroup = $this->callAPISuccess('option_group', 'get', [
       'name' => 'case_status',
       'format.only_id' => 1,
-    ));
+    ]);
     $optionValues = [
       'Medical evaluation' => 'Medical evaluation',
       'Mental health evaluation' => "Mental health evaluation",
@@ -67,7 +67,7 @@ class CiviCaseTestCase extends CiviUnitTestCase {
     // Now, the rule is simply: use the "name" from "civicrm_case_type.name".
     $this->caseType = 'housing_support';
     $this->caseTypeId = 1;
-    $this->tablesToTruncate = array(
+    $this->tablesToTruncate = [
       'civicrm_activity',
       'civicrm_contact',
       'civicrm_custom_group',
@@ -81,14 +81,14 @@ class CiviCaseTestCase extends CiviUnitTestCase {
       'civicrm_relationship',
       'civicrm_relationship_type',
       'civicrm_uf_match',
-    );
+    ];
 
     $this->quickCleanup($this->tablesToTruncate);
 
     $this->loadAllFixtures();
 
     // enable the default custom templates for the case type xml files
-    $this->customDirectories(array('template_path' => TRUE));
+    $this->customDirectories(['template_path' => TRUE]);
 
     // case is not enabled by default
     $enableResult = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
@@ -96,7 +96,7 @@ class CiviCaseTestCase extends CiviUnitTestCase {
 
     /** @var \CRM_Utils_Hook_UnitTests $hooks  */
     $hooks = \CRM_Utils_Hook::singleton();
-    $hooks->setHook('civicrm_caseTypes', array($this, 'hook_caseTypes'));
+    $hooks->setHook('civicrm_caseTypes', [$this, 'hook_caseTypes']);
     \CRM_Case_XMLRepository::singleton(TRUE);
     \CRM_Case_XMLProcessor::flushStaticCaches();
 
@@ -113,7 +113,7 @@ class CiviCaseTestCase extends CiviUnitTestCase {
    * This method is called after a test is executed.
    */
   public function tearDown(): void {
-    $this->customDirectories(array('template_path' => FALSE));
+    $this->customDirectories(['template_path' => FALSE]);
     $this->quickCleanup($this->tablesToTruncate, TRUE);
     CRM_Case_XMLRepository::singleton(TRUE);
     parent::tearDown();
index 272670c071f8486c3599e1cb6e2724a51cfca899..4434150e53a78c194777197f23045cfcdfa7424c 100644 (file)
@@ -13,10 +13,10 @@ class CiviEndToEndTestCase extends PHPUnit\Framework\TestCase implements \Civi\T
 
   public static function setUpBeforeClass(): void {
     CRM_Core_Config::singleton(1, 1);
-    CRM_Utils_System::loadBootStrap(array(
+    CRM_Utils_System::loadBootStrap([
       'name' => $GLOBALS['_CV']['ADMIN_USER'],
       'pass' => $GLOBALS['_CV']['ADMIN_PASS'],
-    ));
+    ]);
     CRM_Utils_System::synchronizeUsers();
 
     parent::setUpBeforeClass();
index 347f7b2935088eba7ab64b2b53d217b282009890..272423759f2061fcee6e261bfc64b790fd7c4d07 100644 (file)
@@ -221,7 +221,7 @@ class CiviMailUtils extends PHPUnit\Framework\TestCase {
     $this->_ut->assertEquals(
       $expectedRecipients,
       $recipients,
-      "Incorrect recipients: " . print_r(array('expected' => $expectedRecipients, 'actual' => $recipients), TRUE)
+      "Incorrect recipients: " . print_r(['expected' => $expectedRecipients, 'actual' => $recipients], TRUE)
     );
   }
 
@@ -242,7 +242,7 @@ class CiviMailUtils extends PHPUnit\Framework\TestCase {
     $this->_ut->assertEquals(
       $expectedSubjects,
       $subjects,
-      "Incorrect subjects: " . print_r(array('expected' => $expectedSubjects, 'actual' => $subjects), TRUE)
+      "Incorrect subjects: " . print_r(['expected' => $expectedSubjects, 'actual' => $subjects], TRUE)
     );
   }
 
index 687f80852416762abc9cf05c8cf134ceeb6954dc..45789ec48f67502dace1f9127196ff6fe9eb6827 100644 (file)
@@ -126,10 +126,10 @@ class CiviReportTestCase extends CiviUnitTestCase {
     );
 
     foreach ($actualCsvArray as $intKey => $strVal) {
-      $rowData = var_export(array(
+      $rowData = var_export([
         'expected' => $expectedCsvArray[$intKey],
         'actual' => $actualCsvArray[$intKey],
-      ), TRUE);
+      ], TRUE);
       $this->assertNotNull($expectedCsvArray[$intKey]);
       $this->assertEquals(
         count($actualCsvArray[$intKey]),
index 9d7d80ee9f7762b128d44f5a6ee601374337f4f7..075c18c3eae0c49fc45e8f59bd5e0ce01e77a92d 100644 (file)
@@ -24,7 +24,7 @@ class CiviTestSMSProvider extends CRM_SMS_Provider {
 
   public static function &singleton($providerParams = [], $force = FALSE) {
     if (isset($providerParams['provider'])) {
-      $providers = CRM_SMS_BAO_Provider::getProviders(NULL, array('name' => $providerParams['provider']));
+      $providers = CRM_SMS_BAO_Provider::getProviders(NULL, ['name' => $providerParams['provider']]);
       $provider = current($providers);
       $providerID = $provider['id'] ?? NULL;
     }
index a12fc9923577393a117c3c5e361e65299f97e5ea..017fbff91c719b988da70400eb299ef0f4880e56 100644 (file)
@@ -79,7 +79,7 @@ function _phpunit_mockoloader($prefix, $base_dir, $class) {
  */
 function cv($cmd, $decode = 'json') {
   $cmd = 'cv ' . $cmd;
-  $descriptorSpec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => STDERR);
+  $descriptorSpec = [0 => ["pipe", "r"], 1 => ["pipe", "w"], 2 => STDERR];
   $oldOutput = getenv('CV_OUTPUT');
   putenv("CV_OUTPUT=json");
   $process = proc_open($cmd, $descriptorSpec, $pipes, __DIR__);
index d66f6b1501a06bad7866472365356f25bb52f276..fe27030030632bcf8082ad4cb32f0c293f2191f8 100644 (file)
@@ -20,10 +20,10 @@ abstract class E2E_Cache_CacheTestCase extends CiviSimpleCacheTest implements \C
 
   public static function setUpBeforeClass(): void {
     CRM_Core_Config::singleton(1, 1);
-    CRM_Utils_System::loadBootStrap(array(
+    CRM_Utils_System::loadBootStrap([
       'name' => $GLOBALS['_CV']['ADMIN_USER'],
       'pass' => $GLOBALS['_CV']['ADMIN_PASS'],
-    ));
+    ]);
     CRM_Utils_System::synchronizeUsers();
 
     parent::setUpBeforeClass();
index dc3069bccf007d8b8f77e5960bf9e171454267e1..8cf5bf014bfe40796bc4a58c81399cb080fc7733 100644 (file)
@@ -176,7 +176,7 @@ class E2E_Cache_TwoInstancesTest extends CiviEndToEndTestCase {
 
     $a = $this->a = CRM_Utils_Cache::create($cacheA);
     $b = $this->b = CRM_Utils_Cache::create($cacheB);
-    return array($a, $b);
+    return [$a, $b];
   }
 
 }
index 991329beec90e126401e52d26c29c913e13fbc95..699628319a2fbe24fb3adaa0383bdaa081eadca2 100644 (file)
@@ -23,15 +23,15 @@ class AssetBuilderTest extends \CiviEndToEndTestCase {
     \Civi::service('asset_builder')->clear();
 
     $this->fired['hook_civicrm_buildAsset'] = 0;
-    \Civi::dispatcher()->addListener('hook_civicrm_buildAsset', array($this, 'counter'));
-    \Civi::dispatcher()->addListener('hook_civicrm_buildAsset', array($this, 'buildSquareTxt'));
-    \Civi::dispatcher()->addListener('hook_civicrm_buildAsset', array($this, 'buildSquareJs'));
+    \Civi::dispatcher()->addListener('hook_civicrm_buildAsset', [$this, 'counter']);
+    \Civi::dispatcher()->addListener('hook_civicrm_buildAsset', [$this, 'buildSquareTxt']);
+    \Civi::dispatcher()->addListener('hook_civicrm_buildAsset', [$this, 'buildSquareJs']);
   }
 
   protected function tearDown(): void {
-    \Civi::dispatcher()->removeListener('hook_civicrm_buildAsset', array($this, 'counter'));
-    \Civi::dispatcher()->removeListener('hook_civicrm_buildAsset', array($this, 'buildSquareTxt'));
-    \Civi::dispatcher()->removeListener('hook_civicrm_buildAsset', array($this, 'buildSquareJs'));
+    \Civi::dispatcher()->removeListener('hook_civicrm_buildAsset', [$this, 'counter']);
+    \Civi::dispatcher()->removeListener('hook_civicrm_buildAsset', [$this, 'buildSquareTxt']);
+    \Civi::dispatcher()->removeListener('hook_civicrm_buildAsset', [$this, 'buildSquareJs']);
     parent::tearDown();
   }
 
@@ -51,7 +51,7 @@ class AssetBuilderTest extends \CiviEndToEndTestCase {
     if ($e->asset !== 'square.txt') {
       return;
     }
-    $this->assertTrue(in_array($e->params['x'], array(11, 12)));
+    $this->assertTrue(in_array($e->params['x'], [11, 12]));
 
     $e->mimeType = 'text/plain';
     $e->content = "Square: " . ($e->params['x'] * $e->params['x']);
@@ -65,7 +65,7 @@ class AssetBuilderTest extends \CiviEndToEndTestCase {
     if ($e->asset !== 'square.js') {
       return;
     }
-    $this->assertTrue(in_array($e->params['x'], array(11, 12)));
+    $this->assertTrue(in_array($e->params['x'], [11, 12]));
 
     $e->mimeType = 'application/javascript';
     $e->content = "var square=" . ($e->params['x'] * $e->params['x']) . ';';
@@ -78,24 +78,24 @@ class AssetBuilderTest extends \CiviEndToEndTestCase {
   public function getExamples() {
     $examples = [];
 
-    $examples[] = array(
+    $examples[] = [
       0 => 'square.txt',
-      1 => array('x' => 11),
+      1 => ['x' => 11],
       2 => 'text/plain',
       3 => 'Square: 121',
-    );
-    $examples[] = array(
+    ];
+    $examples[] = [
       0 => 'square.txt',
-      1 => array('x' => 12),
+      1 => ['x' => 12],
       2 => 'text/plain',
       3 => 'Square: 144',
-    );
-    $examples[] = array(
+    ];
+    $examples[] = [
       0 => 'square.js',
-      1 => array('x' => 12),
+      1 => ['x' => 12],
       2 => 'application/javascript',
       3 => 'var square=144;',
-    );
+    ];
 
     return $examples;
   }
@@ -171,7 +171,7 @@ class AssetBuilderTest extends \CiviEndToEndTestCase {
     $url = \Civi::service('asset_builder')->getUrl('invalid.json');
     try {
       $guzzleClient = new \GuzzleHttp\Client();
-      $guzzleResponse = $guzzleClient->request('GET', $url, array('timeout' => 2));
+      $guzzleResponse = $guzzleClient->request('GET', $url, ['timeout' => 2]);
       $this->fail('Expecting ClientException... but it was not thrown!');
     }
     catch (\GuzzleHttp\Exception\ClientException $e) {
index c1a5bd90aab93a8015febe1d6bfbc5e3085bdf00..35eb6b6ab6b866359cf52e36fb47b7be368e707e 100644 (file)
@@ -54,7 +54,7 @@ class PrevNextTest extends \CiviEndToEndTestCase {
     $sql = $query->searchQuery($start, $prefillLimit, $sort, FALSE, $query->_includeContactIds,
       FALSE, TRUE, TRUE);
     $selectSQL = "SELECT DISTINCT %1, contact_a.id, contact_a.sort_name";
-    $sql = str_replace(array("SELECT contact_a.id as contact_id", "SELECT contact_a.id as id"), $selectSQL, $sql);
+    $sql = str_replace(["SELECT contact_a.id as contact_id", "SELECT contact_a.id as id"], $selectSQL, $sql);
 
     $this->assertTrue(
       $this->prevNext->fillWithSql($this->cacheKey, $sql, [1 => [$this->cacheKey, 'String']]),
index 9d12ae31a43ce77b4d6e3c9152a4f4501294c0af..1bcfd8d84458d8fd53c88024ce39c4a1fc857f41 100644 (file)
@@ -71,18 +71,18 @@ abstract class E2E_Extern_BaseRestTest extends CiviEndToEndTestCase {
   protected function tearDown(): void {
     if (!empty($this->old_api_keys)) {
       foreach ($this->old_api_keys as $cid => $apiKey) {
-        civicrm_api3('Contact', 'create', array(
+        civicrm_api3('Contact', 'create', [
           'id' => $cid,
           'api_key' => $apiKey,
-        ));
+        ]);
       }
     }
     parent::tearDown();
     if (isset($this->nocms_contact_id)) {
-      $deleteParams = array(
+      $deleteParams = [
         "id" => $this->nocms_contact_id,
         "skip_undelete" => 1,
-      );
+      ];
       $res = civicrm_api3("Contact", "delete", $deleteParams);
       unset($this->nocms_contact_id);
     }
@@ -98,124 +98,124 @@ abstract class E2E_Extern_BaseRestTest extends CiviEndToEndTestCase {
     $cases = [];
 
     // entity,action: omit apiKey, valid entity+action
-    $cases[] = array(
+    $cases[] = [
       // query
-      array(
+      [
         "entity" => "Contact",
         "action" => "get",
         "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
         "json" => "1",
-      ),
+      ],
       // is_error
       1,
-    );
+    ];
 
     // entity,action: valid apiKey, valid entity+action
-    $cases[] = array(
+    $cases[] = [
       // query
-      array(
+      [
         "entity" => "Contact",
         "action" => "get",
         "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
         "json" => "1",
         "api_key" => self::getApiKey(),
-      ),
+      ],
       // is_error
       0,
-    );
+    ];
 
     // entity,action: bad apiKey, valid entity+action
-    $cases[] = array(
+    $cases[] = [
       // query
-      array(
+      [
         "entity" => "Contact",
         "action" => "get",
         "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
         "json" => "1",
         "api_key" => 'garbage_' . self::getApiKey(),
-      ),
+      ],
       // is_error
       1,
-    );
+    ];
 
     // entity,action: valid apiKey, invalid entity+action
-    $cases[] = array(
+    $cases[] = [
       // query
-      array(
+      [
         "entity" => "Contactses",
         "action" => "get",
         "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
         "json" => "1",
         "api_key" => self::getApiKey(),
-      ),
+      ],
       // is_error
       1,
-    );
+    ];
 
     // q=civicrm/entity/action: omit apiKey, valid entity+action
-    $cases[] = array(
+    $cases[] = [
       // query
-      array(
+      [
         "q" => "civicrm/contact/get",
         "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
         "json" => "1",
-      ),
+      ],
       // is_error
       1,
-    );
+    ];
 
     // q=civicrm/entity/action: valid apiKey, valid entity+action
-    $cases[] = array(
+    $cases[] = [
       // query
-      array(
+      [
         "q" => "civicrm/contact/get",
         "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
         "json" => "1",
         "api_key" => self::getApiKey(),
-      ),
+      ],
       // is_error
       0,
-    );
+    ];
 
     // q=civicrm/entity/action: invalid apiKey, valid entity+action
-    $cases[] = array(
+    $cases[] = [
       // query
-      array(
+      [
         "q" => "civicrm/contact/get",
         "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
         "json" => "1",
         "api_key" => 'garbage_' . self::getApiKey(),
-      ),
+      ],
       // is_error
       1,
-    );
+    ];
 
     // q=civicrm/entity/action: valid apiKey, invalid entity+action
-    $cases[] = array(
+    $cases[] = [
       // query
-      array(
+      [
         "q" => "civicrm/contactses/get",
         "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
         "json" => "1",
         "api_key" => self::getApiKey(),
-      ),
+      ],
       // is_error
       1,
-    );
+    ];
 
     // q=civicrm/entity/action: valid apiKey, invalid entity+action
     // XXX Actually Ping is valid, no?
-    $cases[] = array(
+    $cases[] = [
       // query
-      array(
+      [
         "q" => "civicrm/ping",
         "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
         "json" => "1",
         "api_key" => self::getApiKey(),
-      ),
+      ],
       // is_error
       0,
-    );
+    ];
 
     if (!$this->isOldQSupported()) {
       $cases = array_filter($cases, function($case) {
@@ -242,11 +242,11 @@ abstract class E2E_Extern_BaseRestTest extends CiviEndToEndTestCase {
 
     $result = json_decode($data, TRUE);
     if ($result === NULL) {
-      $msg = print_r(array(
+      $msg = print_r([
         'restUrl' => $this->getRestUrl(),
         'query' => $query,
         'response data' => $data,
-      ), TRUE);
+      ], TRUE);
       $this->assertNotNull($result, $msg);
     }
     $this->assertAPIErrorCode($result, $is_error);
@@ -261,22 +261,22 @@ abstract class E2E_Extern_BaseRestTest extends CiviEndToEndTestCase {
 
     //Create contact with api_key
     $test_key = "testing1234";
-    $contactParams = array(
+    $contactParams = [
       "api_key" => $test_key,
       "contact_type" => "Individual",
       "first_name" => "RestTester1",
-    );
+    ];
     $contact = civicrm_api3("Contact", "create", $contactParams);
     $this->nocms_contact_id = $contact["id"];
 
     // The key associates with a real contact but not a real user
-    $params = array(
+    $params = [
       "entity" => "Contact",
       "action" => "get",
       "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
       "json" => "1",
       "api_key" => $test_key,
-    );
+    ];
 
     $response = $http->post($this->getRestUrl(), ['form_params' => $params]);
     $this->assertStatusCode(200, $response);
@@ -295,14 +295,14 @@ abstract class E2E_Extern_BaseRestTest extends CiviEndToEndTestCase {
 
     //Create contact with api_key
     // The key associates with a real contact but not a real user
-    $params = array(
+    $params = [
       "entity" => "Contact",
       "action" => "get",
       "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
       "json" => "1",
       "api_key" => self::getApiKey(),
       "id" => "user_contact_id",
-    );
+    ];
     $response = $http->post($this->getRestUrl(), ['form_params' => $params]);
     $this->assertStatusCode(200, $response);
     $result = json_decode((string) $response->getBody(), TRUE);
@@ -322,21 +322,21 @@ abstract class E2E_Extern_BaseRestTest extends CiviEndToEndTestCase {
 
     //Create contact with api_key
     $test_key = "testing1234";
-    $contactParams = array(
+    $contactParams = [
       "api_key" => $test_key,
       "contact_type" => "Individual",
       "first_name" => "RestTester1",
-    );
+    ];
     $contact = civicrm_api3("Contact", "create", $contactParams);
     $this->nocms_contact_id = $contact["id"];
 
     // The key associates with a real contact but not a real user
-    $params = array(
+    $params = [
       "q" => "civicrm/contact/get",
       "key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
       "json" => "1",
       "api_key" => $test_key,
-    );
+    ];
     $response = $http->post($this->getRestUrl(), ['form_params' => $params]);
 
     $this->assertStatusCode(200, $response);
@@ -347,10 +347,10 @@ abstract class E2E_Extern_BaseRestTest extends CiviEndToEndTestCase {
 
   protected function updateAdminApiKey() {
     /** @var int $adminContactId */
-    $this->adminContactId = civicrm_api3('contact', 'getvalue', array(
+    $this->adminContactId = civicrm_api3('contact', 'getvalue', [
       'id' => '@user:' . $GLOBALS['_CV']['ADMIN_USER'],
       'return' => 'id',
-    ));
+    ]);
 
     $this->old_api_keys[$this->adminContactId] = CRM_Core_DAO::singleValueQuery('SELECT api_key FROM civicrm_contact WHERE id = %1', [
       1 => [$this->adminContactId, 'Positive'],
@@ -361,10 +361,10 @@ abstract class E2E_Extern_BaseRestTest extends CiviEndToEndTestCase {
     //  'return' => 'api_key',
     //));
 
-    civicrm_api3('Contact', 'create', array(
+    civicrm_api3('Contact', 'create', [
       'id' => $this->adminContactId,
       'api_key' => self::getApiKey(),
-    ));
+    ]);
   }
 
   protected static function getApiKey() {