Add without() Method

This commit is contained in:
2025-10-25 12:06:55 -04:00
parent 1a0c5bdc30
commit 67255faf77
3 changed files with 8 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}
}