From c45f8e22def9201e02f9f3850b9147405412d440 Mon Sep 17 00:00:00 2001 From: Robin van der Vliet Date: Fri, 23 Jun 2023 19:50:18 +0200 Subject: [PATCH] Use short array syntax --- examples/multi_curl_set_custom_instance_tag.php | 2 +- src/Curl/Curl.php | 4 ++-- tests/PHPCurlClass/ArrayUtilTest.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/multi_curl_set_custom_instance_tag.php b/examples/multi_curl_set_custom_instance_tag.php index 7dc6179..1270a47 100644 --- a/examples/multi_curl_set_custom_instance_tag.php +++ b/examples/multi_curl_set_custom_instance_tag.php @@ -9,7 +9,7 @@ $tags_to_urls = [ 'tag5' => 'https://httpbin.org/status/503', ]; -$ids_to_tags = array(); +$ids_to_tags = []; $multi_curl = new MultiCurl(); diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 8bf0581..4b92efb 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -1325,7 +1325,7 @@ class Curl extends BaseCurl if ($this->attempts === 0) { echo 'No HTTP requests have been made.' . "\n"; } else { - $request_types = array( + $request_types = [ 'DELETE' => $this->getOpt(CURLOPT_CUSTOMREQUEST) === 'DELETE', 'GET' => $this->getOpt(CURLOPT_CUSTOMREQUEST) === 'GET' || $this->getOpt(CURLOPT_HTTPGET), 'HEAD' => $this->getOpt(CURLOPT_CUSTOMREQUEST) === 'HEAD', @@ -1334,7 +1334,7 @@ class Curl extends BaseCurl 'POST' => $this->getOpt(CURLOPT_CUSTOMREQUEST) === 'POST' || $this->getOpt(CURLOPT_POST), 'PUT' => $this->getOpt(CURLOPT_CUSTOMREQUEST) === 'PUT', 'SEARCH' => $this->getOpt(CURLOPT_CUSTOMREQUEST) === 'SEARCH', - ); + ]; $request_method = ''; foreach ($request_types as $http_method_name => $http_method_used) { if ($http_method_used) { diff --git a/tests/PHPCurlClass/ArrayUtilTest.php b/tests/PHPCurlClass/ArrayUtilTest.php index e2561a4..e891106 100644 --- a/tests/PHPCurlClass/ArrayUtilTest.php +++ b/tests/PHPCurlClass/ArrayUtilTest.php @@ -33,7 +33,7 @@ class ArrayUtilTest extends \PHPUnit\Framework\TestCase public function testArrayFlattenMultidimArray() { - $data = array( + $data = [ 'key-1' => 'value-1', 'key-2' => 'value-2', 'key-3' => [ @@ -44,7 +44,7 @@ class ArrayUtilTest extends \PHPUnit\Framework\TestCase 'nested-more-key-2' => 'nested-more-value-2', ], ], - ); + ]; $this->assertEquals([ 'key-1' => 'value-1',