Skip to content

Commit 8903c86

Browse files
committed
Requests: Fix style issues
1 parent e6ea3f8 commit 8903c86

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

Diff for: src/Exception.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Exception extends PHPException {
3434
*
3535
* @var boolean
3636
*/
37-
public $failed_hook_handled = FALSE;
37+
public $failed_hook_handled = false;
3838

3939
/**
4040
* Create a new exception

Diff for: src/Exception/InvalidArgument.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class InvalidArgument extends InvalidArgumentException {
1717
*
1818
* @var boolean
1919
*/
20-
public $failed_hook_handled = FALSE;
20+
public $failed_hook_handled = false;
2121

2222
/**
2323
* Create a new invalid argument exception with a standardized text.

Diff for: src/Requests.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -474,16 +474,16 @@ public static function request($url, $headers = [], $data = [], $type = self::GE
474474

475475
$parsed_response = self::parse_response($response, $url, $headers, $data, $options);
476476
} catch (Exception $e) {
477-
if ($e->failed_hook_handled === FALSE) {
477+
if ($e->failed_hook_handled === false) {
478478
$options['hooks']->dispatch('requests.failed', [&$e, $url, $headers, $data, $type, $options]);
479-
$e->failed_hook_handled = TRUE;
479+
$e->failed_hook_handled = true;
480480
}
481481

482482
throw $e;
483483
} catch (InvalidArgument $e) {
484-
if ($e->failed_hook_handled === FALSE) {
484+
if ($e->failed_hook_handled === false) {
485485
$options['hooks']->dispatch('requests.failed', [&$e, $url, $headers, $data, $type, $options]);
486-
$e->failed_hook_handled = TRUE;
486+
$e->failed_hook_handled = true;
487487
}
488488

489489
throw $e;

Diff for: tests/Fixtures/TransportRedirectMock.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ final class TransportRedirectMock implements Transport {
1212

1313
private $redirected = [];
1414

15-
public $redirected_transport = NULL;
15+
public $redirected_transport = null;
1616

1717
private static $messages = [
1818
100 => '100 Continue',
@@ -64,26 +64,26 @@ final class TransportRedirectMock implements Transport {
6464
];
6565

6666
public function request($url, $headers = [], $data = [], $options = []) {
67-
if (array_key_exists($url, $this->redirected))
68-
{
67+
if (array_key_exists($url, $this->redirected)) {
6968
return $this->redirected_transport->request($url, $headers, $data, $options);
7069
}
7170

72-
$redirect_url = "https://example.com/redirected?url=" . urlencode($url);
71+
$redirect_url = 'https://example.com/redirected?url=' . urlencode($url);
7372

7473
$status = isset(self::$messages[$this->code]) ? self::$messages[$this->code] : $this->code . ' unknown';
7574
$response = "HTTP/1.0 $status\r\n";
7675
$response .= "Content-Type: text/plain\r\n";
7776
if ($this->chunked) {
7877
$response .= "Transfer-Encoding: chunked\r\n";
7978
}
79+
8080
$response .= "Location: $redirect_url\r\n";
8181
$response .= $this->raw_headers;
8282
$response .= "Connection: close\r\n\r\n";
8383
$response .= $this->body;
8484

85-
$this->redirected[$url] = TRUE;
86-
$this->redirected[$redirect_url] = TRUE;
85+
$this->redirected[$url] = true;
86+
$this->redirected[$redirect_url] = true;
8787

8888
return $response;
8989
}

Diff for: tests/RequestsTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ public function testRedirectToExceptionTriggersRequestsFailedCallbackOnce() {
428428
$transport = new TransportRedirectMock();
429429
$transport->redirected_transport = new TransportFailedMock();
430430

431-
$options = [
431+
$options = [
432432
'hooks' => $hooks,
433433
'transport' => $transport,
434434
];
@@ -451,7 +451,7 @@ public function testRedirectToInvalidArgumentTriggersRequestsFailedCallbackOnce(
451451
$transport = new TransportRedirectMock();
452452
$transport->redirected_transport = new TransportInvalidArgumentMock();
453453

454-
$options = [
454+
$options = [
455455
'hooks' => $hooks,
456456
'transport' => $transport,
457457
];

0 commit comments

Comments
 (0)