Skip to content

Commit

Permalink
fix(Condition): fix an issue with array_pad/array_shift chain
Browse files Browse the repository at this point in the history
  • Loading branch information
Leksat committed Apr 18, 2023
1 parent 46d061e commit 45360b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/GraphQL/Resolver/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public function __construct(array $branches) {
*/
public function resolve($value, $args, ResolveContext $context, ResolveInfo $info, FieldContext $field) {
$branches = $this->branches;
while ([$condition, $resolver] = array_pad(array_shift($branches), 2, NULL)) {
while ($branch = array_shift($branches)) {
[$condition, $resolver] = array_pad($branch, 2, NULL);
if ($condition instanceof ResolverInterface) {
if (($condition = $condition->resolve($value, $args, $context, $info, $field)) === NULL) {
// Bail out early if a resolver returns NULL.
Expand Down

0 comments on commit 45360b3

Please sign in to comment.