File tree 2 files changed +14
-1
lines changed
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)
177
177
public static function __callStatic ($ name , $ arguments )
178
178
{
179
179
$ array = static ::toArray ();
180
- if (isset ($ array [$ name ])) {
180
+ if (isset ($ array [$ name ]) || \array_key_exists ( $ name , $ array ) ) {
181
181
return new static ($ array [$ name ]);
182
182
}
183
183
Original file line number Diff line number Diff line change @@ -266,4 +266,17 @@ public function testJsonSerialize()
266
266
$ this ->assertJsonStringEqualsJsonString ('"" ' , json_encode (new EnumFixture (EnumFixture::PROBLEMATIC_EMPTY_STRING )));
267
267
$ this ->assertJsonStringEqualsJsonString ('false ' , json_encode (new EnumFixture (EnumFixture::PROBLEMATIC_BOOLEAN_FALSE )));
268
268
}
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
+ }
269
282
}
You can’t perform that action at this time.
0 commit comments