File tree Expand file tree Collapse file tree 2 files changed +1
-17
lines changed
Expand file tree Collapse file tree 2 files changed +1
-17
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ protected function castValue(
3838
3939 /** @var class-string<\BackedEnum> $type */
4040 try {
41- return $ value instanceof $ type && $ value === $ type :: from ( $ value -> value ) ? $ value : $ type ::from ($ value );
41+ return $ type ::from ($ value );
4242 } catch (Throwable $ e ) {
4343 throw CannotCastEnum::create ($ type , $ value );
4444 }
Original file line number Diff line number Diff line change 7171 )
7272 ->toEqual (Uncastable::create ());
7373});
74-
75-
76- it ('it can create data when enum is already casted ' , function () {
77- $ class = new class () {
78- public DummyBackedEnum $ enum ;
79- };
80-
81- expect (
82- $ this ->caster ->cast (
83- FakeDataStructureFactory::property ($ class , 'enum ' ),
84- DummyBackedEnum::FOO ,
85- [],
86- CreationContextFactory::createFromConfig ($ class ::class)->get ()
87- )
88- )->toEqual (DummyBackedEnum::FOO );
89- });
You can’t perform that action at this time.
0 commit comments