| Conditions | 11 |
| Paths | 10 |
| Total Lines | 46 |
| Code Lines | 23 |
| 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 declare(strict_types=1); |
||
| 41 | public function processNode(Node $node, Scope $scope): array |
||
| 42 | { |
||
| 43 | if ($this->isTestClass($scope)) { |
||
| 44 | return []; |
||
| 45 | } |
||
| 46 | |||
| 47 | if (!$node->name instanceof Identifier) { |
||
| 48 | return []; |
||
| 49 | } |
||
| 50 | |||
| 51 | if ((string) $node->name !== 'addFlags') { |
||
| 52 | return []; |
||
| 53 | } |
||
| 54 | |||
| 55 | $class = $scope->getClassReflection(); |
||
| 56 | |||
| 57 | if ($class === null) { |
||
| 58 | return []; |
||
| 59 | } |
||
| 60 | |||
| 61 | foreach ($node->getArgs() as $arg) { |
||
| 62 | if ($this->resolveClassName($arg->value) !== RuleAreas::class) { |
||
| 63 | continue; |
||
| 64 | } |
||
| 65 | |||
| 66 | if ($class->getName() !== RuleDefinition::class) { |
||
| 67 | return [ |
||
| 68 | 'RuleAreas flag may only be added within the scope of RuleDefinition', |
||
| 69 | ]; |
||
| 70 | } |
||
| 71 | |||
| 72 | $fieldClassName = $this->resolveClassName($node->var); |
||
| 73 | |||
| 74 | if (!$fieldClassName || !$this->reflectionProvider->hasClass($fieldClassName)) { |
||
| 75 | continue; |
||
| 76 | } |
||
| 77 | |||
| 78 | $mockedClass = $this->reflectionProvider->getClass($fieldClassName); |
||
| 79 | if (!$mockedClass->isSubclassOf(AssociationField::class)) { |
||
| 80 | return [ |
||
| 81 | 'RuleAreas flag may only be added on instances of AssociationField', |
||
| 82 | ]; |
||
| 83 | } |
||
| 84 | } |
||
| 85 | |||
| 86 | return []; |
||
| 87 | } |
||
| 122 |
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