From 6a2fb0a826a9daf6353df62aca455dbbfaeb1e22 Mon Sep 17 00:00:00 2001 From: ignace nyamagana butera Date: Sat, 21 Dec 2024 12:24:13 +0100 Subject: [PATCH] Adding tryNew to all URI related classes which already have a new method --- Contracts/UriAccess.php | 3 +++ Contracts/UriComponentInterface.php | 3 +++ Contracts/UriInterface.php | 1 + 3 files changed, 7 insertions(+) diff --git a/Contracts/UriAccess.php b/Contracts/UriAccess.php index 7c37cda..76efedc 100644 --- a/Contracts/UriAccess.php +++ b/Contracts/UriAccess.php @@ -15,6 +15,9 @@ use Psr\Http\Message\UriInterface as Psr7UriInterface; +/** + * @method self when(callable|bool $condition, callable $onSuccess, ?callable $onFail = null) conditionally return a new instance + */ interface UriAccess { public function getUri(): UriInterface|Psr7UriInterface; diff --git a/Contracts/UriComponentInterface.php b/Contracts/UriComponentInterface.php index e478516..7a69423 100644 --- a/Contracts/UriComponentInterface.php +++ b/Contracts/UriComponentInterface.php @@ -16,6 +16,9 @@ use JsonSerializable; use Stringable; +/** + * @method static when(callable|bool $condition, callable $onSuccess, ?callable $onFail = null) conditionally return a new instance + */ interface UriComponentInterface extends JsonSerializable, Stringable { /** diff --git a/Contracts/UriInterface.php b/Contracts/UriInterface.php index 1fde6b9..ae335dd 100644 --- a/Contracts/UriInterface.php +++ b/Contracts/UriInterface.php @@ -25,6 +25,7 @@ * @method string|null getUsername() returns the user component of the URI. * @method string|null getPassword() returns the scheme-specific information about how to gain authorization to access the resource. * @method array toComponents() returns an associative array containing all the URI components. + * @method self when(callable|bool $condition, callable $onSuccess, ?callable $onFail = null) conditionally return a new instance */ interface UriInterface extends JsonSerializable, Stringable {