Skip to content

Commit 00c8777

Browse files
committed
Merge branch 'sensitive-parameter' into development
2 parents 2414df3 + 481cf33 commit 00c8777

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

guide/index.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ With it it is possible to obtain the protocol:
264264

265265
.. code-block:: php
266266
267-
$protocol = $response->getProtocol();
267+
$protocol = $response->getProtocol(); // string
268268
269269
Response Status
270270
###############
@@ -273,9 +273,9 @@ Also, you can get the response status:
273273

274274
.. code-block:: php
275275
276-
$response->getStatusCode();
277-
$response->getStatusReason();
278-
$response->getStatus();
276+
$response->getStatusCode(); // int
277+
$response->getStatusReason(); // string
278+
$response->getStatus(); // string
279279
280280
Response Headers
281281
################
@@ -284,7 +284,7 @@ It is also possible to get all headers at once:
284284

285285
.. code-block:: php
286286
287-
$headers = $response->getHeaders();
287+
$headers = $response->getHeaders(); // array
288288
289289
Or, get the headers individually:
290290

@@ -302,7 +302,7 @@ The message body, when set, can be obtained with the ``getBody`` method:
302302

303303
.. code-block:: php
304304
305-
$body = $response->getBody();
305+
$body = $response->getBody(); // string
306306
307307
JSON Response
308308
#############
@@ -313,7 +313,7 @@ as an object or array in PHP:
313313
.. code-block:: php
314314
315315
if ($response->isJson()) {
316-
$data = $response->getJson();
316+
$data = $response->getJson(); // object or false
317317
}
318318
319319
Conclusion

src/Request.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use JetBrains\PhpStorm\Pure;
2626
use JsonException;
2727
use OutOfBoundsException;
28+
use SensitiveParameter;
2829

2930
/**
3031
* Class Request.
@@ -475,8 +476,10 @@ public function removeHeaders() : static
475476
*
476477
* @return static
477478
*/
478-
public function setBasicAuth(string $username, string $password) : static
479-
{
479+
public function setBasicAuth(
480+
string $username,
481+
#[SensitiveParameter] string $password
482+
) : static {
480483
return $this->setHeader(
481484
RequestHeader::AUTHORIZATION,
482485
'Basic ' . \base64_encode($username . ':' . $password)
@@ -490,7 +493,7 @@ public function setBasicAuth(string $username, string $password) : static
490493
*
491494
* @return static
492495
*/
493-
public function setBearerAuth(string $token) : static
496+
public function setBearerAuth(#[SensitiveParameter] string $token) : static
494497
{
495498
return $this->setHeader(
496499
RequestHeader::AUTHORIZATION,

0 commit comments

Comments
 (0)