Skip to content

Commit

Permalink
patch for PHP8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wol-soft committed Aug 19, 2024
1 parent 9e756be commit 30807e3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Model/SchemaDefinition/JsonSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,18 @@ public function __construct(string $file, array $json)
{
// wrap in an allOf to pass the processing to multiple handlers - ugly hack to be removed after rework
if (isset($json['$ref']) && count(array_diff(array_intersect(array_keys($json), self::SCHEMA_SIGNATURE_RELEVANT_FIELDS), ['$ref', 'type']))) {
$json = [
...array_diff_key($json, array_fill_keys(self::SCHEMA_SIGNATURE_RELEVANT_FIELDS, null)),
'allOf' => [
['$ref' => $json['$ref']],
array_intersect_key(
$json,
array_fill_keys(array_diff(self::SCHEMA_SIGNATURE_RELEVANT_FIELDS, ['$ref']), null),
),
$json = array_merge(
array_diff_key($json, array_fill_keys(self::SCHEMA_SIGNATURE_RELEVANT_FIELDS, null)),
[
'allOf' => [
['$ref' => $json['$ref']],
array_intersect_key(
$json,
array_fill_keys(array_diff(self::SCHEMA_SIGNATURE_RELEVANT_FIELDS, ['$ref']), null),
),
],
],
];
);
}

$this->json = $json;
Expand Down

0 comments on commit 30807e3

Please sign in to comment.