Skip to content

Commit

Permalink
keep type parameters if present when inferring object type
Browse files Browse the repository at this point in the history
  • Loading branch information
goetas committed May 4, 2020
1 parent 16f30f3 commit ffc2ef6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/GraphNavigator/SerializationGraphNavigator.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function accept($data, ?array $type = null)
// metadata for the actual type of the object, not the base class.
if (class_exists($type['name'], false) || interface_exists($type['name'], false)) {
if (is_subclass_of($data, $type['name'], false)) {
$type = ['name' => \get_class($data), 'params' => []];
$type = ['name' => \get_class($data), 'params' => $type['params'] ?? []];
}
}

Expand Down

0 comments on commit ffc2ef6

Please sign in to comment.