Skip to content
Permalink
Browse files

Reduce number of ops

  • Loading branch information...
zachborboa committed May 13, 2019
1 parent 73bf10e commit 9a538f3a6bd6ccad3f76eb4a711c04f820cc6c9b
@@ -211,7 +211,7 @@ public function key()
*/
public function valid()
{
return (bool) !(key($this->data) === null);
return (bool) (key($this->data) !== null);
}
/**
@@ -371,7 +371,7 @@ public function exec($ch = null)
$this->rawResponse = curl_multi_getcontent($ch);
$this->curlErrorMessage = curl_error($ch);
}
$this->curlError = !($this->curlErrorCode === 0);
$this->curlError = $this->curlErrorCode !== 0;
// Transfer the header callback data and release the temporary store to avoid memory leak.
$this->rawResponseHeaders = $this->headerCallbackData->rawResponseHeaders;
@@ -443,7 +443,7 @@ public function execDone()
$this->call($this->completeCallback);
// Close open file handles and reset the curl instance.
if (!($this->fileHandle === null)) {
if ($this->fileHandle !== null) {
$this->downloadComplete($this->fileHandle);
}
}
@@ -1007,7 +1007,7 @@ public function setOpt($option, $value)
CURLOPT_RETURNTRANSFER => 'CURLOPT_RETURNTRANSFER',
);
if (in_array($option, array_keys($required_options), true) && !($value === true)) {
if (in_array($option, array_keys($required_options), true) && $value !== true) {
trigger_error($required_options[$option] . ' is a required option', E_USER_WARNING);
}
@@ -29,7 +29,7 @@ public static function encodeJson()
}
$value = call_user_func_array('json_encode', $args);
if (!(json_last_error() === JSON_ERROR_NONE)) {
if (json_last_error() !== JSON_ERROR_NONE) {
if (function_exists('json_last_error_msg')) {
$error_message = 'json_encode error: ' . json_last_error_msg();
} else {
@@ -785,7 +785,7 @@ public function start()
curl_multi_remove_handle($this->multiCurl, $curl->curl);
$curlm_error_code = curl_multi_add_handle($this->multiCurl, $curl->curl);
if (!($curlm_error_code === CURLM_OK)) {
if ($curlm_error_code !== CURLM_OK) {
throw new \ErrorException(
'cURL multi add handle error: ' . curl_multi_strerror($curlm_error_code)
);
@@ -957,7 +957,7 @@ private function initHandle($curl)
}
$curlm_error_code = curl_multi_add_handle($this->multiCurl, $curl->curl);
if (!($curlm_error_code === CURLM_OK)) {
if ($curlm_error_code !== CURLM_OK) {
throw new \ErrorException('cURL multi add handle error: ' . curl_multi_strerror($curlm_error_code));
}
@@ -110,7 +110,7 @@ function upload_file_to_server($upload_file_path) {
$uploaded_file_path = $upload_test->curl->response->file_path;
// Ensure files are not the same path.
assert(!($upload_file_path === $uploaded_file_path));
assert($upload_file_path !== $uploaded_file_path);
// Ensure file uploaded successfully.
assert(md5_file($upload_file_path) === $upload_test->curl->responseHeaders['ETag']);
@@ -915,7 +915,7 @@ public function testMaxFilesize()
$expect_error = $test['expect_error'];
$test = new Test();
if (!($max_filesize === false)) {
if ($max_filesize !== false) {
$test->curl->setMaxFilesize($max_filesize);
}
$test->server('download_file_size', 'GET', array(
@@ -1095,7 +1095,7 @@ public function testCookieJar()
$test->server('cookiejar', 'GET');
$test->curl->close();
$this->assertTrue(!(strpos(file_get_contents($cookie_jar), "\t" . 'mycookie' . "\t" . 'yum') === false));
$this->assertTrue(strpos(file_get_contents($cookie_jar), "\t" . 'mycookie' . "\t" . 'yum') !== false);
unlink($cookie_jar);
$this->assertFalse(file_exists($cookie_jar));
}
@@ -3521,7 +3521,7 @@ public function testRetry()
$test = new Test();
$test->curl->setOpt(CURLOPT_COOKIEJAR, '/dev/null');
if (!($maximum_number_of_retries === null)) {
if ($maximum_number_of_retries !== null) {
$test->curl->setRetry($maximum_number_of_retries);
}
@@ -3595,7 +3595,7 @@ public function testRetryCallable()
$test = new Test();
$test->curl->setOpt(CURLOPT_COOKIEJAR, '/dev/null');
if (!($maximum_number_of_retries === null)) {
if ($maximum_number_of_retries !== null) {
$test->curl->setRetry(function ($instance) use ($maximum_number_of_retries) {
$return = $instance->retries < $maximum_number_of_retries;
return $return;
@@ -2565,7 +2565,7 @@ public function testAddRequestAfterStart()
$multi_curl->complete(function ($instance) use (&$multi_curl, &$urls, &$urls_called) {
$urls_called[] = $instance->url;
$next_url = array_pop($urls);
if (!($next_url === null)) {
if ($next_url !== null) {
$multi_curl->addGet($next_url);
}
});
@@ -2768,7 +2768,7 @@ public function testRetryMulti()
$multi_curl->setOpt(CURLOPT_COOKIEJAR, '/dev/null');
$multi_curl->setHeader('X-DEBUG-TEST', 'retry');
if (!($maximum_number_of_retries === null)) {
if ($maximum_number_of_retries !== null) {
$multi_curl->setRetry($maximum_number_of_retries);
}
@@ -2845,7 +2845,7 @@ public function testRetryCallableMulti()
$multi_curl->setOpt(CURLOPT_COOKIEJAR, '/dev/null');
$multi_curl->setHeader('X-DEBUG-TEST', 'retry');
if (!($maximum_number_of_retries === null)) {
if ($maximum_number_of_retries !== null) {
$multi_curl->setRetry(function ($instance) use ($maximum_number_of_retries) {
$return = $instance->retries < $maximum_number_of_retries;
return $return;
@@ -25,7 +25,7 @@ public function __construct($http_range_header, $file_path)
// "If the last-byte-pos value is present, it MUST be greater than or equal to the first-byte-pos in that
// byte-range-spec, or the byte- range-spec is syntactically invalid."
if (!($this->last_byte === null) && !($this->last_byte >= $this->first_byte)) {
if ($this->last_byte !== null && !($this->last_byte >= $this->first_byte)) {
$this->is_valid = false;
}
}
@@ -110,7 +110,7 @@
$A1 . ':' . $data['nonce'] . ':' . $data['nc'] . ':' . $data['cnonce'] . ':' . $data['qop'] . ':' . $A2
);
if (!($data['response'] === $valid_response)) {
if ($data['response'] !== $valid_response) {
header('HTTP/1.1 401 Unauthorized');
echo 'invalid';
exit;
@@ -48,7 +48,7 @@ find_invalid_indentation() {
$line_number += 1;
$leading_space_count = strspn($line, ' ');
$remainder = $leading_space_count % 4;
if (!($remainder === 0)) {
if ($remainder !== 0) {
// Allow doc comments.
if (substr(ltrim($line), 0, 1) === '*') {
continue;

0 comments on commit 9a538f3

Please sign in to comment.
You can’t perform that action at this time.