From 67255faf7792f90e5da7075399b852634723cf2e Mon Sep 17 00:00:00 2001 From: Jay Potter Date: Sat, 25 Oct 2025 12:06:55 -0400 Subject: [PATCH] Add without() Method --- src/Potter/Aware/AbstractAware.php | 1 + src/Potter/Aware/AwareInterface.php | 1 + src/Potter/Aware/AwareTrait.php | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/src/Potter/Aware/AbstractAware.php b/src/Potter/Aware/AbstractAware.php index c267858..4c76a0b 100644 --- a/src/Potter/Aware/AbstractAware.php +++ b/src/Potter/Aware/AbstractAware.php @@ -11,4 +11,5 @@ abstract class AbstractAware implements AwareInterface abstract protected function set(string $key, mixed $value): mixed; abstract protected function unset(string $key): void; abstract public function with(string $key, mixed $value): AwareInterface; + abstract public function without(string $key): AwareInterface; } diff --git a/src/Potter/Aware/AwareInterface.php b/src/Potter/Aware/AwareInterface.php index 1f5539f..2ffc9a5 100644 --- a/src/Potter/Aware/AwareInterface.php +++ b/src/Potter/Aware/AwareInterface.php @@ -9,4 +9,5 @@ interface AwareInterface public function get(string $key): mixed; public function has(string $key): bool; public function with(string $key, mixed $value): self; + public function without(string $key): self; } diff --git a/src/Potter/Aware/AwareTrait.php b/src/Potter/Aware/AwareTrait.php index 7ebbb79..b11ad50 100644 --- a/src/Potter/Aware/AwareTrait.php +++ b/src/Potter/Aware/AwareTrait.php @@ -37,4 +37,10 @@ trait AwareTrait ($clone = $this->clone())->set($key, $value); return $clone; } + + final public function without(string $key): AwareInterface + { + ($clone = $this->clone())->unset($key); + return $clone; + } }