diff --git a/src/Enum.php b/src/Enum.php index 1ee2573..00355df 100644 --- a/src/Enum.php +++ b/src/Enum.php @@ -150,7 +150,7 @@ public static function isValidKey($key) { $array = static::toArray(); - return isset($array[$key]); + return isset($array[$key]) || \array_key_exists($key, $array); } /** diff --git a/tests/EnumTest.php b/tests/EnumTest.php index 0e8ea8f..3349bd1 100644 --- a/tests/EnumTest.php +++ b/tests/EnumTest.php @@ -190,6 +190,7 @@ public function testIsValidKey() { $this->assertTrue(EnumFixture::isValidKey('FOO')); $this->assertFalse(EnumFixture::isValidKey('BAZ')); + $this->assertTrue(EnumFixture::isValidKey('PROBLEMATIC_NULL')); } /**