| Conditions | 26 |
| Paths | 20 |
| Total Lines | 64 |
| Code Lines | 43 |
| 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 |
||
| 82 | protected function getDirectiveLocationFromASTPath(NodeInterface $node): ?string |
||
| 83 | { |
||
| 84 | /** @var NodeInterface $appliedTo */ |
||
| 85 | $appliedTo = $node->getAncestor(); |
||
| 86 | |||
| 87 | if ($appliedTo instanceof OperationDefinitionNode) { |
||
| 88 | switch ($appliedTo->getOperation()) { |
||
| 89 | case 'query': |
||
| 90 | return DirectiveLocationEnum::QUERY; |
||
| 91 | case 'mutation': |
||
| 92 | return DirectiveLocationEnum::MUTATION; |
||
| 93 | case 'subscription': |
||
| 94 | return DirectiveLocationEnum::SUBSCRIPTION; |
||
| 95 | default: |
||
| 96 | return null; |
||
| 97 | } |
||
| 98 | } |
||
| 99 | if ($appliedTo instanceof FieldNode) { |
||
| 100 | return DirectiveLocationEnum::FIELD; |
||
| 101 | } |
||
| 102 | if ($appliedTo instanceof FragmentSpreadNode) { |
||
| 103 | return DirectiveLocationEnum::FRAGMENT_SPREAD; |
||
| 104 | } |
||
| 105 | if ($appliedTo instanceof InlineFragmentNode) { |
||
| 106 | return DirectiveLocationEnum::INLINE_FRAGMENT; |
||
| 107 | } |
||
| 108 | if ($appliedTo instanceof FragmentDefinitionNode) { |
||
| 109 | return DirectiveLocationEnum::FRAGMENT_DEFINITION; |
||
| 110 | } |
||
| 111 | if ($appliedTo instanceof SchemaDefinitionNode) { |
||
| 112 | return DirectiveLocationEnum::SCHEMA; |
||
| 113 | } |
||
| 114 | if ($appliedTo instanceof ScalarTypeDefinitionNode || $appliedTo instanceof ScalarTypeExtensionNode) { |
||
| 115 | return DirectiveLocationEnum::SCALAR; |
||
| 116 | } |
||
| 117 | if ($appliedTo instanceof ObjectTypeDefinitionNode || $appliedTo instanceof ObjectTypeExtensionNode) { |
||
| 118 | return DirectiveLocationEnum::OBJECT; |
||
| 119 | } |
||
| 120 | if ($appliedTo instanceof FieldDefinitionNode) { |
||
| 121 | return DirectiveLocationEnum::FIELD_DEFINITION; |
||
| 122 | } |
||
| 123 | if ($appliedTo instanceof InterfaceTypeDefinitionNode || $appliedTo instanceof InterfaceTypeExtensionNode) { |
||
| 124 | return DirectiveLocationEnum::INTERFACE; |
||
| 125 | } |
||
| 126 | if ($appliedTo instanceof UnionTypeDefinitionNode || $appliedTo instanceof UnionTypeExtensionNode) { |
||
| 127 | return DirectiveLocationEnum::UNION; |
||
| 128 | } |
||
| 129 | if ($appliedTo instanceof EnumTypeDefinitionNode || $appliedTo instanceof EnumTypeExtensionNode) { |
||
| 130 | return DirectiveLocationEnum::ENUM; |
||
| 131 | } |
||
| 132 | if ($appliedTo instanceof EnumValueDefinitionNode) { |
||
| 133 | return DirectiveLocationEnum::ENUM_VALUE; |
||
| 134 | } |
||
| 135 | if ($appliedTo instanceof InputObjectTypeDefinitionNode || $appliedTo instanceof InputObjectTypeExtensionNode) { |
||
| 136 | return DirectiveLocationEnum::INPUT_OBJECT; |
||
| 137 | } |
||
| 138 | if ($appliedTo instanceof InputValueDefinitionNode) { |
||
| 139 | $parentNode = $node->getAncestor(2); |
||
| 140 | return $parentNode instanceof InputObjectTypeDefinitionNode |
||
| 141 | ? DirectiveLocationEnum::INPUT_FIELD_DEFINITION |
||
| 142 | : DirectiveLocationEnum::ARGUMENT_DEFINITION; |
||
| 143 | } |
||
| 144 | |||
| 145 | return null; |
||
| 146 | } |
||
| 148 |
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