From 83fef19679be7448dccec81da604695a8c13e737 Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Wed, 8 Oct 2025 08:50:34 +0200 Subject: [PATCH] Remove pass-by-reference for `$result` in `ReferenceExecutor` Follows up on https://github.com/webonyx/graphql-php/pull/1776#discussion_r2411090574 --- src/Executor/ReferenceExecutor.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Executor/ReferenceExecutor.php b/src/Executor/ReferenceExecutor.php index 93ba8ce80..3ce475dd3 100644 --- a/src/Executor/ReferenceExecutor.php +++ b/src/Executor/ReferenceExecutor.php @@ -864,7 +864,7 @@ protected function completeValue( ResolveInfo $info, array $path, array $unaliasedPath, - &$result, + $result, $contextValue ) { // If result is an Error, throw a located error. @@ -1007,7 +1007,7 @@ protected function completeListValue( ResolveInfo $info, array $path, array $unaliasedPath, - iterable &$results, + iterable $results, $contextValue ) { $itemType = $returnType->getWrappedType(); @@ -1045,7 +1045,7 @@ protected function completeListValue( * * @return mixed */ - protected function completeLeafValue(LeafType $returnType, &$result) + protected function completeLeafValue(LeafType $returnType, $result) { try { return $returnType->serialize($result); @@ -1079,7 +1079,7 @@ protected function completeAbstractValue( ResolveInfo $info, array $path, array $unaliasedPath, - &$result, + $result, $contextValue ) { $typeCandidate = $returnType->resolveType($result, $contextValue, $info); @@ -1213,7 +1213,7 @@ protected function completeObjectValue( ResolveInfo $info, array $path, array $unaliasedPath, - &$result, + $result, $contextValue ) { // If there is an isTypeOf predicate function, call it with the @@ -1229,7 +1229,7 @@ protected function completeObjectValue( $fieldNodes, $path, $unaliasedPath, - &$result + $result ) { if (! $isTypeOfResult) { throw $this->invalidReturnTypeError($returnType, $result, $fieldNodes); @@ -1296,7 +1296,7 @@ protected function collectAndExecuteSubfields( \ArrayObject $fieldNodes, array $path, array $unaliasedPath, - &$result, + $result, $contextValue ) { $subFieldNodes = $this->collectSubFields($returnType, $fieldNodes); @@ -1444,7 +1444,7 @@ protected function ensureValidRuntimeType( $runtimeTypeOrName, AbstractType $returnType, ResolveInfo $info, - &$result + $result ): ObjectType { $runtimeType = is_string($runtimeTypeOrName) ? $this->exeContext->schema->getType($runtimeTypeOrName)