|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
/** |
|
3
|
|
|
* PHP version 7.4 |
|
4
|
|
|
* |
|
5
|
|
|
* This source file is subject to the license that is bundled with this package in the file LICENSE. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace PhUml\Parser\Code; |
|
9
|
|
|
|
|
10
|
|
|
use PhpParser\Node\Stmt; |
|
|
|
|
|
|
11
|
|
|
use PhpParser\NodeTraverser; |
|
|
|
|
|
|
12
|
|
|
use PhUml\Code\Codebase; |
|
13
|
|
|
use PhUml\Parser\Code\Builders\ClassDefinitionBuilder; |
|
14
|
|
|
use PhUml\Parser\Code\Builders\InterfaceDefinitionBuilder; |
|
15
|
|
|
use PhUml\Parser\Code\Builders\TraitDefinitionBuilder; |
|
16
|
|
|
use PhUml\Parser\Code\Visitors\ClassVisitor; |
|
17
|
|
|
use PhUml\Parser\Code\Visitors\InterfaceVisitor; |
|
18
|
|
|
use PhUml\Parser\Code\Visitors\TraitVisitor; |
|
19
|
|
|
|
|
20
|
|
|
final class PhpTraverser |
|
21
|
|
|
{ |
|
22
|
|
|
protected Codebase $codebase; |
|
23
|
|
|
|
|
24
|
|
|
protected NodeTraverser $traverser; |
|
25
|
|
|
|
|
26
|
|
|
public function __construct( |
|
27
|
|
|
ClassDefinitionBuilder $classBuilder, |
|
28
|
|
|
InterfaceDefinitionBuilder $interfaceBuilder, |
|
29
|
|
|
TraitDefinitionBuilder $traitBuilder |
|
30
|
|
|
) { |
|
31
|
|
|
$this->codebase = new Codebase(); |
|
32
|
|
|
$this->traverser = new NodeTraverser(); |
|
33
|
|
|
$this->traverser->addVisitor(new ClassVisitor($classBuilder, $this->codebase)); |
|
34
|
|
|
$this->traverser->addVisitor(new InterfaceVisitor($interfaceBuilder, $this->codebase)); |
|
35
|
|
|
$this->traverser->addVisitor(new TraitVisitor($traitBuilder, $this->codebase)); |
|
36
|
108 |
|
} |
|
37
|
|
|
|
|
38
|
108 |
|
/** |
|
39
|
108 |
|
* It will create a `Definition` from the given nodes. |
|
40
|
|
|
* It will add the `Definition` to the `Codebase` |
|
41
|
111 |
|
* |
|
42
|
|
|
* @param Stmt[] $nodes |
|
43
|
111 |
|
* @see PhpCodeParser::parse() |
|
44
|
|
|
*/ |
|
45
|
|
|
public function traverse(array $nodes): void |
|
46
|
|
|
{ |
|
47
|
|
|
$this->traverser->traverse($nodes); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function codebase(): Codebase |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->codebase; |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
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