Conditions | 1 |
Paths | 1 |
Total Lines | 110 |
Code Lines | 43 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
111 | $processor->processPayload($query); |
||
112 | $result = $processor->getResponseData(); |
||
113 | |||
114 | $this->assertEquals($expected, $result); |
||
115 | } |
||
116 | |||
117 | public function queries() |
||
118 | { |
||
119 | return [ |
||
120 | [ |
||
121 | '{ test:nonNullArgument2(ids: [1, 2]) }', |
||
122 | [ |
||
123 | 'data' => [ |
||
124 | 'test' => 1, |
||
125 | ], |
||
126 | ], |
||
127 | ], |
||
128 | [ |
||
129 | '{ test:nonNullArgument2(ids: [1, null]) }', |
||
130 | [ |
||
131 | 'data' => [ |
||
132 | 'test' => null, |
||
133 | ], |
||
134 | 'errors' => [ |
||
135 | [ |
||
136 | 'message' => 'Not valid type for argument "ids" in query "nonNullArgument2": Field must not be NULL', |
||
137 | 'locations' => [['line' => 1, 'column' => 25]], |
||
138 | ], |
||
139 | ], |
||
140 | ], |
||
141 | ], |
||
142 | [ |
||
143 | '{ test:nonNullArgument(ids: [1, null]) }', |
||
144 | [ |
||
145 | 'data' => [ |
||
146 | 'test' => 1, |
||
147 | ], |
||
148 | ], |
||
149 | ], |
||
150 | [ |
||
151 | '{ test:nonNullArgument }', |
||
152 | [ |
||
153 | 'data' => [ |
||
154 | 'test' => null, |
||
155 | ], |
||
156 | 'errors' => [ |
||
157 | [ |
||
158 | 'message' => 'Require "ids" arguments to query "nonNullArgument"', |
||
159 | ], |
||
160 | ], |
||
161 | ], |
||
162 | ], |
||
163 | [ |
||
164 | '{ nonNullScalar }', |
||
165 | [ |
||
166 | 'data' => [ |
||
167 | 'nonNullScalar' => null, |
||
168 | ], |
||
169 | 'errors' => [ |
||
170 | [ |
||
171 | 'message' => 'Cannot return null for non-nullable field "nonNullScalar"', |
||
172 | ], |
||
173 | ], |
||
174 | ], |
||
175 | ], |
||
176 | |||
177 | [ |
||
178 | '{ nonNullList }', |
||
179 | [ |
||
180 | 'data' => [ |
||
181 | 'nonNullList' => null, |
||
182 | ], |
||
183 | 'errors' => [ |
||
184 | [ |
||
185 | 'message' => 'Cannot return null for non-nullable field "nonNullList"', |
||
186 | ], |
||
187 | ], |
||
188 | ], |
||
189 | ], |
||
190 | [ |
||
191 | '{ nonNullListOfNpnNull }', |
||
192 | [ |
||
193 | 'data' => [ |
||
194 | 'nonNullListOfNpnNull' => null, |
||
195 | ], |
||
196 | 'errors' => [ |
||
197 | [ |
||
198 | 'message' => 'Not valid resolved type for field "nonNullListOfNpnNull": Field must not be NULL', |
||
199 | ], |
||
200 | ], |
||
201 | ], |
||
202 | ], |
||
203 | |||
204 | [ |
||
205 | '{ user {id, name} }', |
||
206 | [ |
||
207 | 'data' => [ |
||
208 | 'user' => [ |
||
209 | 'id' => '6cfb044c-9c0a-4ddd-9ef8-a0b940818db3', |
||
210 | 'name' => 'Alex', |
||
211 | ], |
||
212 | ], |
||
213 | ], |
||
214 | ], |
||
215 | [ |
||
216 | '{ user { __typename } }', |
||
217 | [ |
||
218 | 'data' => [ |
||
219 | 'user' => [ |
||
220 | '__typename' => 'User', |
||
221 | ], |
||
228 |