@@ -61,7 +61,12 @@ class ReferenceExecutor implements ExecutorImplementation
61
61
*/
62
62
protected \SplObjectStorage $ subFieldCache ;
63
63
64
- /** @var \SplObjectStorage<FieldDefinition, \SplObjectStorage<FieldNode, mixed>> */
64
+ /**
65
+ * @var \SplObjectStorage<
66
+ * FieldDefinition,
67
+ * \SplObjectStorage<FieldNode, mixed>
68
+ * >
69
+ */
65
70
protected \SplObjectStorage $ fieldArgsCache ;
66
71
67
72
protected function __construct (ExecutionContext $ context )
@@ -94,7 +99,7 @@ public static function create(
94
99
array $ variableValues ,
95
100
?string $ operationName ,
96
101
callable $ fieldResolver ,
97
- callable $ argsMapper
102
+ ? callable $ argsMapper = null // TODO make non-optional in next major release
98
103
): ExecutorImplementation {
99
104
$ exeContext = static ::buildExecutionContext (
100
105
$ schema ,
@@ -104,7 +109,7 @@ public static function create(
104
109
$ variableValues ,
105
110
$ operationName ,
106
111
$ fieldResolver ,
107
- $ argsMapper ,
112
+ $ argsMapper ?? Executor:: getDefaultArgsMapper () ,
108
113
$ promiseAdapter ,
109
114
);
110
115
@@ -128,8 +133,8 @@ public function doExecute(): Promise
128
133
}
129
134
130
135
/**
131
- * Constructs an ExecutionContext object from the arguments passed to
132
- * execute, which we will pass throughout the other execution methods.
136
+ * Constructs an ExecutionContext object from the arguments passed to execute,
137
+ * which we will pass throughout the other execution methods.
133
138
*
134
139
* @param mixed $rootValue
135
140
* @param mixed $contextValue
@@ -741,7 +746,7 @@ protected function resolveFieldValueOrError(
741
746
try {
742
747
// Build a map of arguments from the field.arguments AST, using the
743
748
// variables scope to fulfill any variable references.
744
- /** @phpstan-ignore-next-line ignored because no way to tell phpstan what are generics of SplObjectStorage without assign it to var first */
749
+ // @phpstan-ignore-next-line generics of SplObjectStorage are not inferred from empty instantiation
745
750
$ this ->fieldArgsCache [$ fieldDef ] ??= new \SplObjectStorage ();
746
751
747
752
$ args = $ this ->fieldArgsCache [$ fieldDef ][$ fieldNode ] ??= $ argsMapper (Values::getArgumentValues (
@@ -1331,6 +1336,7 @@ protected function collectAndExecuteSubfields(
1331
1336
*/
1332
1337
protected function collectSubFields (ObjectType $ returnType , \ArrayObject $ fieldNodes ): \ArrayObject
1333
1338
{
1339
+ // @phpstan-ignore-next-line generics of SplObjectStorage are not inferred from empty instantiation
1334
1340
$ returnTypeCache = $ this ->subFieldCache [$ returnType ] ??= new \SplObjectStorage ();
1335
1341
1336
1342
if (! isset ($ returnTypeCache [$ fieldNodes ])) {
0 commit comments