File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ public static function search($value)
177177 public static function __callStatic ($ name , $ arguments )
178178 {
179179 $ array = static ::toArray ();
180- if (isset ($ array [$ name ])) {
180+ if (isset ($ array [$ name ]) || \array_key_exists ( $ name , $ array ) ) {
181181 return new static ($ array [$ name ]);
182182 }
183183
Original file line number Diff line number Diff line change @@ -266,4 +266,17 @@ public function testJsonSerialize()
266266 $ this ->assertJsonStringEqualsJsonString ('"" ' , json_encode (new EnumFixture (EnumFixture::PROBLEMATIC_EMPTY_STRING )));
267267 $ this ->assertJsonStringEqualsJsonString ('false ' , json_encode (new EnumFixture (EnumFixture::PROBLEMATIC_BOOLEAN_FALSE )));
268268 }
269+
270+ public function testNullableEnum ()
271+ {
272+ $ this ->assertNull (EnumFixture::PROBLEMATIC_NULL ()->getValue ());
273+ $ this ->assertNull ((new EnumFixture (EnumFixture::PROBLEMATIC_NULL ))->getValue ());
274+ $ this ->assertNull ((new EnumFixture (EnumFixture::PROBLEMATIC_NULL ))->jsonSerialize ());
275+ }
276+
277+ public function testBooleanEnum ()
278+ {
279+ $ this ->assertFalse (EnumFixture::PROBLEMATIC_BOOLEAN_FALSE ()->getValue ());
280+ $ this ->assertFalse ((new EnumFixture (EnumFixture::PROBLEMATIC_BOOLEAN_FALSE ))->jsonSerialize ());
281+ }
269282}
You can’t perform that action at this time.
0 commit comments