Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Commit

Permalink
alter reflection(call_user_func) code style for suit Swoole mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tsingsun committed Jan 27, 2018
1 parent ce50af8 commit a7bb5b0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/GraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ private function parseExecutionResult(ExecutionResult $executeResult)
if (!empty($executeResult->errors)) {
$result['errors'] = [];
foreach ($executeResult->errors as $er) {
$fr = call_user_func_array($this->errorFormatter, [$er]);
$fn = $this->errorFormatter;
$fr = $fn($er);
if (isset($fr['message'])) {
$result['errors'][] = $fr;
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/GraphQLAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public function run()
Yii::$app->response->format = Response::FORMAT_JSON;
if ($this->authActions && $this->checkAccess) {
foreach ($this->authActions as $childAction => $class) {
call_user_func($this->checkAccess, $childAction);
$fn = $this->checkAccess;
$fn($childAction);
}
}
$schema = $this->graphQL->buildSchema($this->schemaArray === true ? null : $this->schemaArray);
Expand Down
2 changes: 1 addition & 1 deletion src/base/GraphQLField.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function getResolver()
$resolver = array($this, 'resolve');
return function () use ($resolver) {
$args = func_get_args();
return call_user_func_array($resolver, $args);
return $resolver(...$args);
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/base/GraphQLInterfaceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function getTypeResolver()
$resolver = array($this, 'resolveType');
return function () use ($resolver) {
$args = func_get_args();
return call_user_func_array($resolver, $args);
return $resolver(...$args);
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/base/GraphQLType.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function getFieldResolver($name, $field)
$resolver = array($this, $resolveMethod);
return function () use ($resolver) {
$args = func_get_args();
return call_user_func_array($resolver, $args);
return $resolver(...$args);
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/base/GraphQLUnionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function getTypeResolver()
$resolver = array($this, 'resolveType');
return function () use ($resolver) {
$args = func_get_args();
return call_user_func_array($resolver, $args);
return $resolver(...$args);
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/traits/ShouldValidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function getResolver()
}
}

return call_user_func_array($resolver, $arguments);
return $resolver(...$arguments);
};
}
}

0 comments on commit a7bb5b0

Please sign in to comment.