Passed
Pull Request — master (#22)
by Luis
24:40 queued 21:48
created

Property::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 8.1
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\Code\Properties;
9
10
use PhUml\Code\Modifiers\CanBeStatic;
11
use PhUml\Code\Modifiers\HasVisibility;
12
use PhUml\Code\Modifiers\Visibility;
0 ignored issues
show
Bug introduced by
The type PhUml\Code\Modifiers\Visibility 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...
13
use PhUml\Code\Modifiers\WithStaticModifier;
14
use PhUml\Code\Modifiers\WithVisibility;
0 ignored issues
show
Bug introduced by
The type PhUml\Code\Modifiers\WithVisibility 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...
15
use PhUml\Code\Name;
16
use PhUml\Code\Variables\HasType;
17
use PhUml\Code\Variables\Variable;
0 ignored issues
show
Bug introduced by
The type PhUml\Code\Variables\Variable 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...
18
use PhUml\Code\Variables\WithVariable;
0 ignored issues
show
Bug introduced by
The type PhUml\Code\Variables\WithVariable 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...
19
use Stringable;
20
21
/**
22
 * It represents an instance variable
23
 */
24
final class Property implements HasType, HasVisibility, CanBeStatic, Stringable
25
{
26
    use WithVisibility;
27
    use WithStaticModifier;
28
    use WithVariable;
29
30 50
    public function __construct(Variable $variable, Visibility $modifier, bool $isStatic = false)
31
    {
32 50
        $this->variable = $variable;
0 ignored issues
show
Bug Best Practice introduced by
The property variable does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
33 50
        $this->modifier = $modifier;
0 ignored issues
show
Bug Best Practice introduced by
The property modifier does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
34 50
        $this->isStatic = $isStatic;
35
    }
36
37
    /** @return Name[] */
38 14
    public function references(): array
39
    {
40 14
        return $this->variable->references();
41
    }
42
43 14
    public function __toString(): string
44
    {
45 14
        return sprintf(
46
            '%s%s',
47 14
            $this->modifier,
48 14
            $this->variable
49
        );
50
    }
51
}
52