File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public function coerce(mixed $value, CoerceState $state): mixed
65
65
66
66
public function dump (mixed $ value , DumpState $ state ): mixed
67
67
{
68
- if (! is_null ($ target = $ this ->resolveVariant (value: $ value ))) {
68
+ if (null !== ($ target = $ this ->resolveVariant (value: $ value ))) {
69
69
return Conversion::dump ($ target , value: $ value , state: $ state );
70
70
}
71
71
@@ -85,8 +85,15 @@ private function resolveVariant(
85
85
return $ value ::class;
86
86
}
87
87
88
- if (!is_null ($ this ->discriminator ) && is_array ($ value ) && array_key_exists ($ this ->discriminator , array: $ value )) {
88
+ if (
89
+ null !== $ this ->discriminator
90
+ && is_array ($ value )
91
+ && array_key_exists ($ this ->discriminator , array: $ value )
92
+ ) {
89
93
$ discriminator = $ value [$ this ->discriminator ];
94
+ if (!is_string ($ discriminator )) {
95
+ return null ;
96
+ }
90
97
91
98
return $ this ->variants [$ discriminator ] ?? null ;
92
99
}
You can’t perform that action at this time.
0 commit comments