Passed
Pull Request — master (#30)
by
unknown
46:28 queued 21:27
created

TraitVisitor::leaveNode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 2
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
/**
3
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
4
 */
5
6
namespace PhUml\Parser\Code\Visitors;
7
8
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...
9
use PhpParser\Node\Stmt\Trait_;
0 ignored issues
show
Bug introduced by
The type PhpParser\Node\Stmt\Trait_ 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
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...
11
use PhUml\Code\Codebase;
12
use PhUml\Parser\Code\Builders\TraitDefinitionBuilder;
13
14
/**
15
 * It builds a `TraitDefinition` and adds it to the `Codebase`
16
 */
17
final class TraitVisitor extends NodeVisitorAbstract
18
{
19 37
    public function __construct(private readonly TraitDefinitionBuilder $builder, private readonly Codebase $codebase)
20
    {
21
    }
22
23 29
    /** @return null|int|Node|Node[]  */
24
    public function leaveNode(Node $node): null|int|Node|array
25 29
    {
26 8
        if ($node instanceof Trait_) {
27
            $this->codebase->add($this->builder->build($node));
28 29
        }
29
        return null;
30
    }
31
}
32