Skip to content

Commit

Permalink
cs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
codeliner committed Feb 17, 2018
1 parent 83fab78 commit 3d7491e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/GraphQL/TypeLanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,23 +244,23 @@ private static function convertSchemaTypeToGraphQLType(string $scope, string $na
$nullable = false;
$type = null;

if(array_key_exists('oneOf', $schemaType)) {
if (array_key_exists('oneOf', $schemaType)) {
$containsNullType = false;
$containsTypeRef = false;
$typeRef = null;
foreach($schemaType['oneOf'] as $oneOfType) {
if(array_key_exists('type', $oneOfType) && $oneOfType['type'] === JsonSchema::TYPE_NULL) {
foreach ($schemaType['oneOf'] as $oneOfType) {
if (array_key_exists('type', $oneOfType) && $oneOfType['type'] === JsonSchema::TYPE_NULL) {
$containsNullType = true;
}

if(array_key_exists('$ref', $oneOfType)) {
if (array_key_exists('$ref', $oneOfType)) {
$containsTypeRef = true;
$typeRef = $oneOfType;
}
}

if(!$containsNullType || !$containsTypeRef) {
throw new \RuntimeException("oneOf schema is only supported for nullable type references. Got " . json_encode($schemaType));
if (! $containsNullType || ! $containsTypeRef) {
throw new \RuntimeException('oneOf schema is only supported for nullable type references. Got ' . json_encode($schemaType));
}

$schemaType = $typeRef;
Expand Down

0 comments on commit 3d7491e

Please sign in to comment.