@@ 274-276 (lines=3) @@ | ||
271 | if ($type['type'] === 'interface') { |
|
272 | return [$type['definition']['name'] => array_values(array_map(function ($type) { |
|
273 | return $type['definition']['name']; |
|
274 | }, array_filter($types, function ($subType) use ($type) { |
|
275 | return $subType['type'] === 'type' && in_array($type['definition']['name'], $subType['definition']['interfaces']); |
|
276 | })))]; |
|
277 | } |
|
278 | ||
279 | // Union types combine the two approaches above. |
|
@@ 285-287 (lines=3) @@ | ||
282 | ||
283 | $implicit = array_values(array_map(function ($type) { |
|
284 | return $type['definition']['name']; |
|
285 | }, array_filter($types, function ($subType) use ($type) { |
|
286 | return $subType['type'] === 'type' && in_array($type['definition']['name'], $subType['definition']['unions']); |
|
287 | }))); |
|
288 | ||
289 | return [$type['definition']['name'] => array_merge($explicit, $implicit)]; |
|
290 | } |