Skip to content

Commit 2dd33f3

Browse files
committed
Requests: Fix style issues
1 parent dca20b2 commit 2dd33f3

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Exception extends PHPException {
3636
*
3737
* @var boolean
3838
*/
39-
public $failed_hook_handled = FALSE;
39+
public $failed_hook_handled = false;
4040

4141
/**
4242
* Create a new exception

src/Exception/InvalidArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class InvalidArgument extends InvalidArgumentException {
2424
*
2525
* @var boolean
2626
*/
27-
public $failed_hook_handled = FALSE;
27+
public $failed_hook_handled = false;
2828

2929
/**
3030
* Create a new invalid argument exception with a standardized text.

src/Requests.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,16 +472,16 @@ public static function request($url, $headers = [], $data = [], $type = self::GE
472472

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

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

487487
throw $e;

tests/Fixtures/TransportRedirectMock.php

Lines changed: 6 additions & 6 deletions
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
}

tests/Requests/RequestsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ public function testRedirectToExceptionTriggersRequestsFailedCallbackOnce() {
408408
$transport = new TransportRedirectMock();
409409
$transport->redirected_transport = new TransportFailedMock();
410410

411-
$options = [
411+
$options = [
412412
'hooks' => $hooks,
413413
'transport' => $transport,
414414
];
@@ -431,7 +431,7 @@ public function testRedirectToInvalidArgumentTriggersRequestsFailedCallbackOnce(
431431
$transport = new TransportRedirectMock();
432432
$transport->redirected_transport = new TransportInvalidArgumentMock();
433433

434-
$options = [
434+
$options = [
435435
'hooks' => $hooks,
436436
'transport' => $transport,
437437
];

0 commit comments

Comments
 (0)