Conditions | 10 |
Paths | 10 |
Total Lines | 34 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
89 | private function create($value): ValueInterface |
||
90 | { |
||
91 | switch (true) { |
||
92 | case $value instanceof ValueInterface: |
||
93 | return $value; |
||
94 | |||
95 | case \is_bool($value): |
||
96 | return BooleanValue::parse($value); |
||
97 | |||
98 | case \is_float($value): |
||
99 | return FloatValue::parse($value); |
||
100 | |||
101 | case \is_int($value): |
||
102 | return IntValue::parse($value); |
||
103 | |||
104 | case $value === null: |
||
105 | return NullValue::parse($value); |
||
106 | |||
107 | case \is_string($value): |
||
108 | return StringValue::parse($value); |
||
109 | |||
110 | case \is_iterable($value): |
||
111 | return $this->fromIterator($value); |
||
112 | |||
113 | default: |
||
114 | foreach ($this->casters as $caster) { |
||
115 | if ($result = $caster($value)) { |
||
116 | return $result; |
||
117 | } |
||
118 | } |
||
119 | |||
120 | $error = 'Value of type %s can not be converted to GraphQL type'; |
||
121 | |||
122 | throw new \InvalidArgumentException(\sprintf($error, Facade::dump($value))); |
||
123 | } |
||
153 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths