| 1 | <?php |
||
| 13 | class Field extends AbstractField implements SecureFieldInterface, TypeSystemPluginReferenceInterface { |
||
| 14 | use TypeSystemPluginReferenceTrait; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The associated type system plugin. |
||
| 18 | * |
||
| 19 | * @var \Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase|\Drupal\graphql\Plugin\GraphQL\Mutations\MutationPluginBase |
||
| 20 | */ |
||
| 21 | protected $plugin; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Indicates if the field is considered secure. |
||
| 25 | * |
||
| 26 | * @var bool |
||
| 27 | */ |
||
| 28 | protected $secure; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * {@inheritdoc} |
||
| 32 | */ |
||
| 33 | public function __construct(FieldPluginBase $plugin, $secure, array $config = []) { |
||
| 38 | |||
| 39 | /** |
||
| 40 | * {@inheritdoc} |
||
| 41 | */ |
||
| 42 | public function resolve($value, array $args, ResolveInfo $info) { |
||
| 45 | |||
| 46 | /** |
||
| 47 | * {@inheritdoc} |
||
| 48 | */ |
||
| 49 | public function getType() { |
||
| 52 | |||
| 53 | /** |
||
| 54 | * {@inheritdoc} |
||
| 55 | */ |
||
| 56 | public function getName() { |
||
| 59 | |||
| 60 | /** |
||
| 61 | * {@inheritdoc} |
||
| 62 | */ |
||
| 63 | public function isSecure() { |
||
| 66 | } |
||
| 67 |
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: