Skip to content

Commit

Permalink
Merge pull request #648 from kylekatarnls/array-unpacking
Browse files Browse the repository at this point in the history
Shorten SelectFields constructor using array unpacking
  • Loading branch information
mfn committed Jun 30, 2020
2 parents 1f9159d + a067ec6 commit 8d8f81c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ parameters:
- '/Cannot access property \$parameters on mixed/'
- '/Parameter #1 \$haystack of function mb_stripos expects string, \(array\)\|string given/'
- '/Strict comparison using === between null and array will always evaluate to false/'
- '/Cannot access offset . on array\|Closure/'
# \Rebing\GraphQL\Support\SelectFields::handleFields
- '/Parameter #1 \$function of function call_user_func expects callable\(\): mixed, array\(mixed, mixed\) given/'
- '/Binary operation "." between string and array\|string\|null results in an error/'
Expand Down
4 changes: 1 addition & 3 deletions src/Support/SelectFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ public function __construct(GraphqlType $parentType, array $queryArgs, $ctx, arr
'fields' => $fieldsAndArguments,
];

$fields = self::getSelectableFieldsAndRelations($queryArgs, $requestedFields, $parentType, null, true, $ctx);
$this->select = $fields[0];
$this->relations = $fields[1];
[$this->select, $this->relations] = self::getSelectableFieldsAndRelations($queryArgs, $requestedFields, $parentType, null, true, $ctx);
}

/**
Expand Down

0 comments on commit 8d8f81c

Please sign in to comment.