| Conditions | 1 |
| Paths | 1 |
| Total Lines | 129 |
| 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 |
||
| 158 | public function predefinedSchemaProvider() |
||
| 159 | { |
||
| 160 | return [ |
||
| 161 | [ |
||
| 162 | '{ __type { name } }', |
||
| 163 | [ |
||
| 164 | 'data' => ['__type' => null], |
||
| 165 | 'errors' => [['message' => 'Require "name" arguments to query "__type"']] |
||
| 166 | ] |
||
| 167 | ], |
||
| 168 | [ |
||
| 169 | '{ __type (name: "__Type") { name } }', |
||
| 170 | [ |
||
| 171 | 'data' => [ |
||
| 172 | '__type' => ['name' => '__Type'] |
||
| 173 | ] |
||
| 174 | ] |
||
| 175 | ], |
||
| 176 | [ |
||
| 177 | '{ __type (name: "InvalidName") { name } }', |
||
| 178 | [ |
||
| 179 | 'data' => [ |
||
| 180 | '__type' => null |
||
| 181 | ] |
||
| 182 | ] |
||
| 183 | ], |
||
| 184 | [ |
||
| 185 | '{ |
||
| 186 | __schema { |
||
| 187 | types { |
||
| 188 | name, |
||
| 189 | fields (includeDeprecated: true) { |
||
| 190 | name |
||
| 191 | args { |
||
| 192 | defaultValue |
||
| 193 | } |
||
| 194 | } |
||
| 195 | } |
||
| 196 | } |
||
| 197 | }', |
||
| 198 | [ |
||
| 199 | 'data' => [ |
||
| 200 | '__schema' => [ |
||
| 201 | 'types' => [ |
||
| 202 | ['name' => 'TestSchemaQuery', 'fields' => [['name' => 'latest', 'args' => [['defaultValue' => 'test'], ['defaultValue' => null]]]]], |
||
| 203 | ['name' => 'Int', 'fields' => null], |
||
| 204 | ['name' => 'LatestType', 'fields' => [['name' => 'id', 'args' => []], ['name' => 'name', 'args' => []]]], |
||
| 205 | ['name' => 'String', 'fields' => null], |
||
| 206 | ['name' => '__Schema', 'fields' => [['name' => 'queryType', 'args' => []], ['name' => 'mutationType', 'args' => []], ['name' => 'subscriptionType', 'args' => []], ['name' => 'types', 'args' => []], ['name' => 'directives', 'args' => []]]], |
||
| 207 | ['name' => '__Type', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'kind', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'ofType', 'args' => []], ['name' => 'inputFields', 'args' => []], ['name' => 'enumValues', 'args' => [['defaultValue' => 'false']]], ['name' => 'fields', 'args' => [['defaultValue' => 'false']]], ['name' => 'interfaces', 'args' => []], ['name' => 'possibleTypes', 'args' => []]]], |
||
| 208 | ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []],]], |
||
| 209 | ['name' => 'Boolean', 'fields' => null], |
||
| 210 | ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []],]], |
||
| 211 | ['name' => '__Field', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'args', 'args' => []]]], |
||
| 212 | ['name' => '__Directive', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'args', 'args' => []], ['name' => 'locations', 'args' => []]]], |
||
| 213 | ['name' => '__DirectiveLocation', 'fields' => null], |
||
| 214 | ] |
||
| 215 | ] |
||
| 216 | ] |
||
| 217 | ] |
||
| 218 | ], |
||
| 219 | [ |
||
| 220 | '{ |
||
| 221 | test : __schema { |
||
| 222 | queryType { |
||
| 223 | kind, |
||
| 224 | name, |
||
| 225 | fields (includeDeprecated: true) { |
||
| 226 | name, |
||
| 227 | isDeprecated, |
||
| 228 | deprecationReason, |
||
| 229 | description, |
||
| 230 | type { |
||
| 231 | name |
||
| 232 | } |
||
| 233 | } |
||
| 234 | } |
||
| 235 | } |
||
| 236 | }', |
||
| 237 | ['data' => [ |
||
| 238 | 'test' => [ |
||
| 239 | 'queryType' => [ |
||
| 240 | 'name' => 'TestSchemaQuery', |
||
| 241 | 'kind' => 'OBJECT', |
||
| 242 | 'fields' => [ |
||
| 243 | ['name' => 'latest', 'isDeprecated' => true, 'deprecationReason' => 'for test', 'description' => 'latest description', 'type' => ['name' => 'LatestType']] |
||
| 244 | ] |
||
| 245 | ] |
||
| 246 | ] |
||
| 247 | ]] |
||
| 248 | ], |
||
| 249 | [ |
||
| 250 | '{ |
||
| 251 | __schema { |
||
| 252 | queryType { |
||
| 253 | kind, |
||
| 254 | name, |
||
| 255 | description, |
||
| 256 | interfaces { |
||
| 257 | name |
||
| 258 | }, |
||
| 259 | possibleTypes { |
||
| 260 | name |
||
| 261 | }, |
||
| 262 | inputFields { |
||
| 263 | name |
||
| 264 | }, |
||
| 265 | ofType{ |
||
| 266 | name |
||
| 267 | } |
||
| 268 | } |
||
| 269 | } |
||
| 270 | }', |
||
| 271 | ['data' => [ |
||
| 272 | '__schema' => [ |
||
| 273 | 'queryType' => [ |
||
| 274 | 'kind' => 'OBJECT', |
||
| 275 | 'name' => 'TestSchemaQuery', |
||
| 276 | 'description' => null, |
||
| 277 | 'interfaces' => [], |
||
| 278 | 'possibleTypes' => null, |
||
| 279 | 'inputFields' => null, |
||
| 280 | 'ofType' => null |
||
| 281 | ] |
||
| 282 | ] |
||
| 283 | ]] |
||
| 284 | ] |
||
| 285 | ]; |
||
| 286 | } |
||
| 287 | |||
| 437 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.