Conditions | 8 |
Paths | 7 |
Total Lines | 54 |
Code Lines | 35 |
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 |
||
26 | public function enterNode(NodeInterface $node): ?NodeInterface |
||
27 | { |
||
28 | if ($node instanceof ArgumentNode) { |
||
29 | $argumentDefinition = $this->validationContext->getArgument(); |
||
30 | |||
31 | if (null === $argumentDefinition) { |
||
32 | $argumentOf = $node->getAncestor(); |
||
33 | if ($argumentOf instanceof FieldNode) { |
||
34 | $fieldDefinition = $this->validationContext->getFieldDefinition(); |
||
35 | $parentType = $this->validationContext->getParentType(); |
||
36 | |||
37 | if (null !== $fieldDefinition && null !== $parentType) { |
||
38 | $this->validationContext->reportError( |
||
39 | new ValidationException( |
||
40 | unknownArgumentMessage( |
||
41 | (string)$node, |
||
42 | (string)$fieldDefinition, |
||
43 | (string)$parentType, |
||
44 | suggestionList( |
||
45 | $node->getNameValue(), |
||
46 | array_map(function (Argument $argument) { |
||
47 | return $argument->getName(); |
||
48 | }, $fieldDefinition->getArguments()) |
||
49 | ) |
||
50 | ), |
||
51 | [$node] |
||
52 | ) |
||
53 | ); |
||
54 | } |
||
55 | } elseif ($argumentOf instanceof DirectiveNode) { |
||
56 | $directive = $this->validationContext->getDirective(); |
||
57 | |||
58 | if (null !== $directive) { |
||
59 | $this->validationContext->reportError( |
||
60 | new ValidationException( |
||
61 | unknownDirectiveArgumentMessage( |
||
62 | (string)$node, |
||
63 | (string)$directive, |
||
64 | suggestionList( |
||
65 | (string)$node, |
||
66 | array_map(function (Argument $argument) { |
||
67 | return $argument->getName(); |
||
68 | }, $directive->getArguments()) |
||
69 | ) |
||
70 | ), |
||
71 | [$node] |
||
72 | ) |
||
73 | ); |
||
74 | } |
||
75 | } |
||
76 | } |
||
77 | } |
||
78 | |||
79 | return $node; |
||
80 | } |
||
82 |
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