Skip to content

Apply fixes from StyleCI #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/HttpAsyncClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testSuccessiveInvalidCallMustUseException()
*/
public function testAsyncSendRequest($method, $uri, array $headers, $body)
{
if ($body != null) {
if (null != $body) {
$headers['Content-Length'] = (string) strlen($body);
}

Expand All @@ -120,7 +120,7 @@ public function testAsyncSendRequest($method, $uri, array $headers, $body)
$this->assertResponse(
$response,
[
'body' => $method === 'HEAD' ? null : 'Ok',
'body' => 'HEAD' === $method ? null : 'Ok',
]
);
$this->assertRequest($method, $headers, $body, '1.1');
Expand Down Expand Up @@ -164,11 +164,11 @@ public function testSendAsyncWithInvalidUri()
*/
public function testSendAsyncRequestWithOutcome($uriAndOutcome, $protocolVersion, array $headers, $body)
{
if ($protocolVersion === '1.0') {
if ('1.0' === $protocolVersion) {
$body = null;
}

if ($body != null) {
if (null != $body) {
$headers['Content-Length'] = (string) strlen($body);
}

Expand Down
6 changes: 3 additions & 3 deletions src/HttpBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function requestProvider()

// Filter all TRACE requests with a body, as they're not HTTP spec compliant
return array_filter($cases, function ($case) {
if ($case[0] === 'TRACE' && $case[3] !== null) {
if ('TRACE' === $case[0] && null !== $case[3]) {
return false;
}

Expand Down Expand Up @@ -232,7 +232,7 @@ protected function assertResponse($response, array $options = [])
$this->assertStringStartsWith($value, $response->getHeaderLine($name));
}

if ($options['body'] === null) {
if (null === $options['body']) {
$this->assertEmpty($response->getBody()->getContents());
} else {
$this->assertContains($options['body'], $response->getBody()->getContents());
Expand Down Expand Up @@ -270,7 +270,7 @@ protected function assertRequest(

$name = strtoupper(str_replace('-', '_', 'http-'.$name));

if ($method === 'TRACE' && $name === 'HTTP_CONTENT_LENGTH' && !isset($request['SERVER'][$name])) {
if ('TRACE' === $method && 'HTTP_CONTENT_LENGTH' === $name && !isset($request['SERVER'][$name])) {
continue;
}

Expand Down
8 changes: 4 additions & 4 deletions src/HttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ abstract protected function createHttpAdapter();
*/
public function testSendRequest($method, $uri, array $headers, $body)
{
if ($body != null) {
if (null != $body) {
$headers['Content-Length'] = (string) strlen($body);
}

Expand All @@ -57,7 +57,7 @@ public function testSendRequest($method, $uri, array $headers, $body)
$this->assertResponse(
$response,
[
'body' => $method === 'HEAD' ? null : 'Ok',
'body' => 'HEAD' === $method ? null : 'Ok',
]
);
$this->assertRequest($method, $headers, $body, '1.1');
Expand All @@ -69,11 +69,11 @@ public function testSendRequest($method, $uri, array $headers, $body)
*/
public function testSendRequestWithOutcome($uriAndOutcome, $protocolVersion, array $headers, $body)
{
if ($protocolVersion === '1.0') {
if ('1.0' === $protocolVersion) {
$body = null;
}

if ($body != null) {
if (null != $body) {
$headers['Content-Length'] = (string) strlen($body);
}

Expand Down
2 changes: 1 addition & 1 deletion src/PHPUnitUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public static function getUri()
*/
public static function getFile($tmp = true, $name = null)
{
return ($tmp ? realpath(sys_get_temp_dir()) : '').'/'.($name === null ? uniqid() : $name);
return ($tmp ? realpath(sys_get_temp_dir()) : '').'/'.(null === $name ? uniqid() : $name);
}
}