Passed
Pull Request — 8.x-1.x (#16)
by Frédéric G.
05:02
created

FunctionCallVisitor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 5
c 1
b 0
f 1
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A enterNode() 0 4 2
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Drupal\qa\Plugin\QaCheck\Dependencies;
6
7
use PhpParser\Node\Expr\FuncCall;
0 ignored issues
show
Bug introduced by
The type PhpParser\Node\Expr\FuncCall was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use PhpParser\NodeVisitorAbstract;
0 ignored issues
show
Bug introduced by
The type PhpParser\NodeVisitorAbstract was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use PhpParser\Node;
0 ignored issues
show
Bug introduced by
The type PhpParser\Node was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
11
/**
12
 * Class FunctionCallVisitor extract the names of called functions.
13
 *
14
 * @see \Drupal\qa\Plugin\QaCheck\Dependencies\Undeclared::functionCalls()
15
 */
16
class FunctionCallVisitor extends NodeVisitorAbstract {
17
18
  /**
19
   * The visitor write pad.
20
   *
21
   * @var array
22
   */
23
  public $pad;
24
25
  /**
26
   * FunctionCallVisitor constructor.
27
   */
28
  public function __construct() {
29
    $this->pad = [];
30
  }
31
32
  /**
33
   * {@inheritdoc}
34
   */
35
  public function enterNode(Node $node) {
36
    // Method calls need a different handling, using MethodCall.
37
    if ($node instanceof FuncCall) {
38
      $this->pad[] = implode('\\', $node->name->parts);
39
    }
40
  }
41
42
}
43