These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | /** |
||
5 | * This file is part of the Ray.Aop package. |
||
6 | * |
||
7 | * @license http://opensource.org/licenses/MIT MIT |
||
8 | */ |
||
9 | namespace Ray\Aop; |
||
10 | |||
11 | use PhpParser\Node; |
||
12 | use PhpParser\Node\Stmt\Declare_; |
||
13 | use PhpParser\Node\Stmt\Use_; |
||
14 | use PhpParser\NodeVisitorAbstract; |
||
15 | |||
16 | class CodeGenVisitor extends NodeVisitorAbstract |
||
17 | { |
||
18 | /** |
||
19 | * @var Node\Stmt[] |
||
20 | */ |
||
21 | private $selectedNodes = []; |
||
22 | |||
23 | /** |
||
24 | * @return Node\Stmt[] |
||
25 | */ |
||
26 | 13 | public function __invoke() : array |
|
27 | { |
||
28 | 13 | return $this->selectedNodes; |
|
29 | } |
||
30 | |||
31 | 13 | public function enterNode(Node $node) |
|
32 | { |
||
33 | 13 | if ($node instanceof Use_ || $node instanceof Declare_) { |
|
0 ignored issues
–
show
The class
PhpParser\Node\Stmt\Declare_ 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 dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed.
Loading history...
|
|||
34 | $this->selectedNodes[] = $node; // @codeCoverageIgnore |
||
35 | } |
||
36 | 13 | } |
|
37 | } |
||
38 |
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 thecomposer.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
orrequire-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 you have not tested against this specific condition, such errors might go unnoticed.