Conditions | 1 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 1 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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 | ])) |
||
35 | 5 | ->addField('defaultValue', TypeMap::TYPE_STRING); |
|
36 | 5 | } |
|
37 | |||
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: