Skip to content

Commit 9a538f3

Browse files
committed
Reduce number of ops
1 parent 73bf10e commit 9a538f3

File tree

10 files changed

+18
-18
lines changed

10 files changed

+18
-18
lines changed

src/Curl/CaseInsensitiveArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function key()
211211
*/
212212
public function valid()
213213
{
214-
return (bool) !(key($this->data) === null);
214+
return (bool) (key($this->data) !== null);
215215
}
216216

217217
/**

src/Curl/Curl.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public function exec($ch = null)
371371
$this->rawResponse = curl_multi_getcontent($ch);
372372
$this->curlErrorMessage = curl_error($ch);
373373
}
374-
$this->curlError = !($this->curlErrorCode === 0);
374+
$this->curlError = $this->curlErrorCode !== 0;
375375

376376
// Transfer the header callback data and release the temporary store to avoid memory leak.
377377
$this->rawResponseHeaders = $this->headerCallbackData->rawResponseHeaders;
@@ -443,7 +443,7 @@ public function execDone()
443443
$this->call($this->completeCallback);
444444

445445
// Close open file handles and reset the curl instance.
446-
if (!($this->fileHandle === null)) {
446+
if ($this->fileHandle !== null) {
447447
$this->downloadComplete($this->fileHandle);
448448
}
449449
}
@@ -1007,7 +1007,7 @@ public function setOpt($option, $value)
10071007
CURLOPT_RETURNTRANSFER => 'CURLOPT_RETURNTRANSFER',
10081008
);
10091009

1010-
if (in_array($option, array_keys($required_options), true) && !($value === true)) {
1010+
if (in_array($option, array_keys($required_options), true) && $value !== true) {
10111011
trigger_error($required_options[$option] . ' is a required option', E_USER_WARNING);
10121012
}
10131013

src/Curl/Encoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function encodeJson()
2929
}
3030

3131
$value = call_user_func_array('json_encode', $args);
32-
if (!(json_last_error() === JSON_ERROR_NONE)) {
32+
if (json_last_error() !== JSON_ERROR_NONE) {
3333
if (function_exists('json_last_error_msg')) {
3434
$error_message = 'json_encode error: ' . json_last_error_msg();
3535
} else {

src/Curl/MultiCurl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ public function start()
785785
curl_multi_remove_handle($this->multiCurl, $curl->curl);
786786

787787
$curlm_error_code = curl_multi_add_handle($this->multiCurl, $curl->curl);
788-
if (!($curlm_error_code === CURLM_OK)) {
788+
if ($curlm_error_code !== CURLM_OK) {
789789
throw new \ErrorException(
790790
'cURL multi add handle error: ' . curl_multi_strerror($curlm_error_code)
791791
);
@@ -957,7 +957,7 @@ private function initHandle($curl)
957957
}
958958

959959
$curlm_error_code = curl_multi_add_handle($this->multiCurl, $curl->curl);
960-
if (!($curlm_error_code === CURLM_OK)) {
960+
if ($curlm_error_code !== CURLM_OK) {
961961
throw new \ErrorException('cURL multi add handle error: ' . curl_multi_strerror($curlm_error_code));
962962
}
963963

tests/PHPCurlClass/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function upload_file_to_server($upload_file_path) {
110110
$uploaded_file_path = $upload_test->curl->response->file_path;
111111

112112
// Ensure files are not the same path.
113-
assert(!($upload_file_path === $uploaded_file_path));
113+
assert($upload_file_path !== $uploaded_file_path);
114114

115115
// Ensure file uploaded successfully.
116116
assert(md5_file($upload_file_path) === $upload_test->curl->responseHeaders['ETag']);

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ public function testMaxFilesize()
915915
$expect_error = $test['expect_error'];
916916

917917
$test = new Test();
918-
if (!($max_filesize === false)) {
918+
if ($max_filesize !== false) {
919919
$test->curl->setMaxFilesize($max_filesize);
920920
}
921921
$test->server('download_file_size', 'GET', array(
@@ -1095,7 +1095,7 @@ public function testCookieJar()
10951095
$test->server('cookiejar', 'GET');
10961096
$test->curl->close();
10971097

1098-
$this->assertTrue(!(strpos(file_get_contents($cookie_jar), "\t" . 'mycookie' . "\t" . 'yum') === false));
1098+
$this->assertTrue(strpos(file_get_contents($cookie_jar), "\t" . 'mycookie' . "\t" . 'yum') !== false);
10991099
unlink($cookie_jar);
11001100
$this->assertFalse(file_exists($cookie_jar));
11011101
}
@@ -3521,7 +3521,7 @@ public function testRetry()
35213521
$test = new Test();
35223522
$test->curl->setOpt(CURLOPT_COOKIEJAR, '/dev/null');
35233523

3524-
if (!($maximum_number_of_retries === null)) {
3524+
if ($maximum_number_of_retries !== null) {
35253525
$test->curl->setRetry($maximum_number_of_retries);
35263526
}
35273527

@@ -3595,7 +3595,7 @@ public function testRetryCallable()
35953595
$test = new Test();
35963596
$test->curl->setOpt(CURLOPT_COOKIEJAR, '/dev/null');
35973597

3598-
if (!($maximum_number_of_retries === null)) {
3598+
if ($maximum_number_of_retries !== null) {
35993599
$test->curl->setRetry(function ($instance) use ($maximum_number_of_retries) {
36003600
$return = $instance->retries < $maximum_number_of_retries;
36013601
return $return;

tests/PHPCurlClass/PHPMultiCurlClassTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,7 +2565,7 @@ public function testAddRequestAfterStart()
25652565
$multi_curl->complete(function ($instance) use (&$multi_curl, &$urls, &$urls_called) {
25662566
$urls_called[] = $instance->url;
25672567
$next_url = array_pop($urls);
2568-
if (!($next_url === null)) {
2568+
if ($next_url !== null) {
25692569
$multi_curl->addGet($next_url);
25702570
}
25712571
});
@@ -2768,7 +2768,7 @@ public function testRetryMulti()
27682768
$multi_curl->setOpt(CURLOPT_COOKIEJAR, '/dev/null');
27692769
$multi_curl->setHeader('X-DEBUG-TEST', 'retry');
27702770

2771-
if (!($maximum_number_of_retries === null)) {
2771+
if ($maximum_number_of_retries !== null) {
27722772
$multi_curl->setRetry($maximum_number_of_retries);
27732773
}
27742774

@@ -2845,7 +2845,7 @@ public function testRetryCallableMulti()
28452845
$multi_curl->setOpt(CURLOPT_COOKIEJAR, '/dev/null');
28462846
$multi_curl->setHeader('X-DEBUG-TEST', 'retry');
28472847

2848-
if (!($maximum_number_of_retries === null)) {
2848+
if ($maximum_number_of_retries !== null) {
28492849
$multi_curl->setRetry(function ($instance) use ($maximum_number_of_retries) {
28502850
$return = $instance->retries < $maximum_number_of_retries;
28512851
return $return;

tests/PHPCurlClass/RangeHeader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct($http_range_header, $file_path)
2525

2626
// "If the last-byte-pos value is present, it MUST be greater than or equal to the first-byte-pos in that
2727
// byte-range-spec, or the byte- range-spec is syntactically invalid."
28-
if (!($this->last_byte === null) && !($this->last_byte >= $this->first_byte)) {
28+
if ($this->last_byte !== null && !($this->last_byte >= $this->first_byte)) {
2929
$this->is_valid = false;
3030
}
3131
}

tests/PHPCurlClass/server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
$A1 . ':' . $data['nonce'] . ':' . $data['nc'] . ':' . $data['cnonce'] . ':' . $data['qop'] . ':' . $A2
111111
);
112112

113-
if (!($data['response'] === $valid_response)) {
113+
if ($data['response'] !== $valid_response) {
114114
header('HTTP/1.1 401 Unauthorized');
115115
echo 'invalid';
116116
exit;

tests/script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ find_invalid_indentation() {
4848
$line_number += 1;
4949
$leading_space_count = strspn($line, ' ');
5050
$remainder = $leading_space_count % 4;
51-
if (!($remainder === 0)) {
51+
if ($remainder !== 0) {
5252
// Allow doc comments.
5353
if (substr(ltrim($line), 0, 1) === '*') {
5454
continue;

0 commit comments

Comments
 (0)