|null $variableValues * @param string|null $operationName * @return array */ public static function execute(Schema $schema, $requestString, $rootObject = null, $variableValues = null, $operationName = null) { try { $source = new Source($requestString ?: '', 'GraphQL request'); $ast = Parser::parse($source); $validationResult = DocumentValidator::validate($schema, $ast); if (empty($validationResult['isValid'])) { return ['errors' => $validationResult['errors']]; } else { return Executor::execute($schema, $rootObject, $ast, $operationName, $variableValues); } } catch (\Exception $e) { return ['errors' => Error::formatError($e)]; } } }