Completed
Push — try/code-signature-diff ( 2d24ed...5d4d06 )
by
unknown
121:31 queued 111:30
created

Visitor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A enterNode() 0 23 2
A leaveNode() 0 5 1
1
<?php
2
3
namespace Automattic\Jetpack\Analyzer\Invocations;
4
5
use PhpParser\NodeVisitorAbstract;
6
use PhpParser\Node;
7
8
class Visitor extends NodeVisitorAbstract {
9
	public $analyzer;
10
11
	public function __construct( $analyzer ) {
12
		$this->analyzer = $analyzer;
13
	}
14
15
	public function enterNode( Node $node ) {
16
17
		if ( $node instanceof Node\Stmt\Class_ ) {
0 ignored issues
show
Bug introduced by
The class PhpParser\Node\Stmt\Class_ does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
18
			echo $node->name->name . "\n";
19
		// 	$this->current_class = $node->name->name;
20
		// 	$this->add( new Declarations\Class_( $this->current_relative_path, $node->getLine(), $node->name->name ) );
21
		}
22
		// if ( $node instanceof Node\Stmt\Property && $node->isPublic() ) {
23
		// 	$this->add( new Declarations\Class_Property( $this->current_relative_path, $node->getLine(), $this->current_class, $node->props[0]->name->name, $node->isStatic() ) );
24
		// }
25
		// if ( $node instanceof Node\Stmt\ClassMethod && $node->isPublic() ) {
26
		// 	// ClassMethods are also listed inside interfaces, which means current_class is null
27
		// 	// so we ignore these
28
		// 	if ( ! $this->current_class ) {
29
		// 		return;
30
		// 	}
31
		// 	$method = new Declarations\Class_Method( $this->current_relative_path, $node->getLine(), $this->current_class, $node->name->name, $node->isStatic() );
32
		// 	foreach ( $node->getParams() as $param ) {
33
		// 		$method->add_param( $param->var->name, $param->default, $param->type, $param->byRef, $param->variadic );
34
		// 	}
35
		// 	$this->add( $method );
36
		// }
37
	}
38
39
	public function leaveNode( Node $node ) {
40
		// if ( $node instanceof Node\Stmt\Class_ ) {
41
		// 	$this->current_class = null;
42
		// }
43
	}
44
}