1 | <?php |
||
20 | abstract class FieldPluginBase extends PluginBase implements TypeSystemPluginInterface { |
||
21 | use CacheablePluginTrait; |
||
22 | use DescribablePluginTrait; |
||
23 | use TypedPluginTrait; |
||
24 | use ArgumentAwarePluginTrait; |
||
25 | use DeprecatablePluginTrait; |
||
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | public static function createInstance(PluggableSchemaBuilder $builder, $definition, $id) { |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | public function getDefinition() { |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | public function resolve($value, array $args, $context, ResolveInfo $info) { |
||
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | protected function resolveDeferred(callable $callback, $value, array $args, ResolveInfo $info) { |
||
87 | |||
88 | /** |
||
89 | * Unwrap the resolved values. |
||
90 | * |
||
91 | * @param array $result |
||
92 | * The resolved values. |
||
93 | * @param \GraphQL\Type\Definition\ResolveInfo $info |
||
94 | * The resolve info object. |
||
95 | * |
||
96 | * @return mixed |
||
97 | * The extracted values (an array of values in case this is a list, an |
||
98 | * arbitrary value if it isn't). |
||
99 | */ |
||
100 | protected function unwrapResult($result, ResolveInfo $info) { |
||
113 | |||
114 | /** |
||
115 | * Retrieve the list of cache dependencies for a given value and arguments. |
||
116 | * |
||
117 | * @param array $result |
||
118 | * The result of the field. |
||
119 | * @param mixed $parent |
||
120 | * The parent value. |
||
121 | * @param array $args |
||
122 | * The arguments passed to the field. |
||
123 | * @param \GraphQL\Type\Definition\ResolveInfo $info |
||
124 | * The resolve info object. |
||
125 | * |
||
126 | * @return array |
||
127 | * A list of cacheable dependencies. |
||
128 | */ |
||
129 | protected function getCacheDependencies(array $result, $parent, array $args, ResolveInfo $info) { |
||
134 | |||
135 | /** |
||
136 | * Retrieve the list of field values. |
||
137 | * |
||
138 | * Always returns a list of field values. Even for single value fields. |
||
139 | * Single/multi field handling is responsibility of the base class. |
||
140 | * |
||
141 | * @param mixed $value |
||
142 | * The current object value. |
||
143 | * @param array $args |
||
144 | * Field arguments. |
||
145 | * @param \GraphQL\Type\Definition\ResolveInfo $info |
||
146 | * The resolve info object. |
||
147 | * |
||
148 | * @return \Generator |
||
149 | * The value generator. |
||
150 | */ |
||
151 | protected function resolveValues($value, array $args, ResolveInfo $info) { |
||
155 | |||
156 | } |
||
157 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.