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
6565
6666 public function dump (mixed $ value , DumpState $ state ): mixed
6767 {
68- if (! is_null ($ target = $ this ->resolveVariant (value: $ value ))) {
68+ if (null !== ($ target = $ this ->resolveVariant (value: $ value ))) {
6969 return Conversion::dump ($ target , value: $ value , state: $ state );
7070 }
7171
@@ -85,8 +85,15 @@ private function resolveVariant(
8585 return $ value ::class;
8686 }
8787
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+ ) {
8993 $ discriminator = $ value [$ this ->discriminator ];
94+ if (!is_string ($ discriminator )) {
95+ return null ;
96+ }
9097
9198 return $ this ->variants [$ discriminator ] ?? null ;
9299 }
You can’t perform that action at this time.
0 commit comments