| 1 | <?php |
||
| 16 | class InputValueType extends AbstractObjectType |
||
| 17 | { |
||
| 18 | |||
| 19 | 2 | public static function resolveType($value) |
|
| 24 | |||
| 25 | 5 | public function build($config) |
|
| 26 | { |
||
| 27 | $config |
||
| 28 | 5 | ->addField('name', TypeMap::TYPE_STRING) |
|
| 29 | 5 | ->addField('description', TypeMap::TYPE_STRING) |
|
| 30 | 5 | ->addField(new Field([ |
|
| 31 | 5 | 'name' => 'type', |
|
| 32 | 5 | 'type' => new QueryType(), |
|
| 33 | 5 | 'resolve' => [get_class($this), 'resolveType'] |
|
| 34 | 5 | ])) |
|
| 35 | 5 | ->addField('defaultValue', TypeMap::TYPE_STRING); |
|
| 36 | 5 | } |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @return String type name |
||
| 40 | */ |
||
| 41 | 7 | public function getName() |
|
| 45 | } |
||
| 46 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: