Skip to content
Open
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
5 changes: 4 additions & 1 deletion docs/authentication-custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ services that do this; perhaps this is a market waiting to be tapped?)
class MySoftware_Auth_Hotdog implements WpOrg\Requests\Auth {
protected $password;

public function __construct($password) {
public function __construct(
#[\SensitiveParameter]
$password
) {
$this->password = $password;
}

Expand Down
6 changes: 5 additions & 1 deletion src/Auth/Basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace WpOrg\Requests\Auth;

use SensitiveParameter;
use WpOrg\Requests\Auth;
use WpOrg\Requests\Exception\ArgumentCount;
use WpOrg\Requests\Exception\InvalidArgument;
Expand Down Expand Up @@ -48,7 +49,10 @@ class Basic implements Auth {
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not an array or null.
* @throws \WpOrg\Requests\Exception\ArgumentCount On incorrect number of array elements (`authbasicbadargs`).
*/
public function __construct($args = null) {
public function __construct(
#[SensitiveParameter]
$args = null
) {
if (is_array($args)) {
if (count($args) !== 2) {
throw ArgumentCount::create('an array with exactly two elements', count($args), 'authbasicbadargs');
Expand Down
6 changes: 5 additions & 1 deletion src/Proxy/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace WpOrg\Requests\Proxy;

use SensitiveParameter;
use WpOrg\Requests\Exception\ArgumentCount;
use WpOrg\Requests\Exception\InvalidArgument;
use WpOrg\Requests\Hooks;
Expand Down Expand Up @@ -65,7 +66,10 @@ final class Http implements Proxy {
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not an array, a string or null.
* @throws \WpOrg\Requests\Exception\ArgumentCount On incorrect number of arguments (`proxyhttpbadargs`)
*/
public function __construct($args = null) {
public function __construct(
#[SensitiveParameter]
$args = null
) {
if (is_string($args)) {
$this->proxy = $args;
} elseif (is_array($args)) {
Expand Down