From 3ad1d91c68e633aead69e9a7494b1dda8f1c6629 Mon Sep 17 00:00:00 2001 From: brabli <67018167+brabli@users.noreply.github.com> Date: Thu, 27 Nov 2025 15:17:14 +0000 Subject: [PATCH] Change has to isSet --- src/Interface/MetadataInterface.php | 2 +- src/Model/Metadata.php | 4 ++-- tests/Model/MetadataTest.php | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Interface/MetadataInterface.php b/src/Interface/MetadataInterface.php index 5e097a4..d885301 100644 --- a/src/Interface/MetadataInterface.php +++ b/src/Interface/MetadataInterface.php @@ -30,6 +30,6 @@ interface MetadataInterface * * @return bool `true` if the key is set (regardless of what the value is), otherwise `false`. */ - public function has(string $key): bool; + public function isSet(string $key): bool; } diff --git a/src/Model/Metadata.php b/src/Model/Metadata.php index ada1869..709acfb 100644 --- a/src/Model/Metadata.php +++ b/src/Model/Metadata.php @@ -21,7 +21,7 @@ final class Metadata implements MetadataInterface public function get(string $key): mixed { - if (!$this->has($key)) { + if (!$this->isSet($key)) { throw new MissingKeyException($key); } @@ -35,7 +35,7 @@ final class Metadata implements MetadataInterface return $this; } - public function has(string $key): bool + public function isSet(string $key): bool { return array_key_exists($key, $this->metadata); } diff --git a/tests/Model/MetadataTest.php b/tests/Model/MetadataTest.php index f9a3b34..5c4b3b8 100644 --- a/tests/Model/MetadataTest.php +++ b/tests/Model/MetadataTest.php @@ -47,17 +47,17 @@ final class MetadataTest extends TestCase $this->assertSame($valueB, $result); } - public function testHasReturnsTrueWhenKeyIsSet(): void + public function testIsSetReturnsTrueWhenKeyIsSet(): void { $key = 'null'; $this->metadata->set($key, null); - $result = $this->metadata->has($key); + $result = $this->metadata->isSet($key); $this->assertTrue($result); } - public function testHasReturnsFalseWhenKeyIsNotSet(): void + public function testIsSetReturnsFalseWhenKeyIsNotSet(): void { - $result = $this->metadata->has('missing'); + $result = $this->metadata->isSet('missing'); $this->assertFalse($result); } }