diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index fac9553..655c6fc 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -311,7 +311,10 @@ class Executor return null; }) ->then(function ($data) { - return new ExecutionResult((array) $data, $this->exeContext->errors); + if ($data === null){ + $data = (array) $data; + } + return new ExecutionResult($data, $this->exeContext->errors); }); } diff --git a/tests/Executor/NonNullTest.php b/tests/Executor/NonNullTest.php index 1519f78..70b88c3 100644 --- a/tests/Executor/NonNullTest.php +++ b/tests/Executor/NonNullTest.php @@ -732,7 +732,6 @@ class NonNullTest extends \PHPUnit_Framework_TestCase '; $expected = [ - 'data' => null, 'errors' => [ FormattedError::create($this->nonNullSyncError->getMessage(), [new SourceLocation(2, 17)]) ] @@ -750,7 +749,6 @@ class NonNullTest extends \PHPUnit_Framework_TestCase $ast = Parser::parse($doc); $expected = [ - 'data' => null, 'errors' => [ FormattedError::create($this->nonNullPromiseError->getMessage(), [new SourceLocation(2, 17)]), ] @@ -789,7 +787,6 @@ class NonNullTest extends \PHPUnit_Framework_TestCase $ast = Parser::parse($doc); $expected = [ - 'data' => null, 'errors' => [ [ 'debugMessage' => 'Cannot return null for non-nullable field DataType.nonNullPromise.',