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\Code\Methods; |
7
|
|
|
|
8
|
|
|
use PhUml\Code\Modifiers\CanBeAbstract; |
9
|
|
|
use PhUml\Code\Modifiers\CanBeStatic; |
10
|
|
|
use PhUml\Code\Modifiers\HasVisibility; |
11
|
|
|
use PhUml\Code\Modifiers\Visibility; |
|
|
|
|
12
|
|
|
use PhUml\Code\Modifiers\WithAbstractModifier; |
13
|
|
|
use PhUml\Code\Modifiers\WithStaticModifier; |
14
|
|
|
use PhUml\Code\Modifiers\WithVisibility; |
15
|
|
|
use PhUml\Code\Parameters\Parameter; |
16
|
|
|
use PhUml\Code\Variables\TypeDeclaration; |
17
|
|
|
use Stringable; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* It represents a class or interface method |
21
|
|
|
*/ |
22
|
|
|
final class Method implements HasVisibility, CanBeAbstract, CanBeStatic, Stringable |
23
|
|
|
{ |
24
|
|
|
use WithVisibility; |
25
|
|
|
use WithAbstractModifier; |
26
|
|
|
use WithStaticModifier; |
27
|
|
|
|
28
|
|
|
/** @param Parameter[] $parameters */ |
29
|
51 |
|
public function __construct( |
30
|
|
|
private readonly string $name, |
31
|
|
|
Visibility $visibility, |
32
|
|
|
private readonly TypeDeclaration $returnType, |
33
|
|
|
private readonly array $parameters = [], |
34
|
|
|
bool $isAbstract = false, |
35
|
|
|
bool $isStatic = false |
36
|
|
|
) { |
37
|
51 |
|
$this->visibility = $visibility; |
|
|
|
|
38
|
51 |
|
$this->isAbstract = $isAbstract; |
39
|
51 |
|
$this->isStatic = $isStatic; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* It is used by the `ClassDefinition` to extract the parameters of a constructor |
44
|
|
|
* |
45
|
|
|
* @see \PhUml\Code\ClassDefinition::hasConstructor() |
46
|
|
|
* @see \PhUml\Code\ClassDefinition::constructorParameters() |
47
|
|
|
*/ |
48
|
15 |
|
public function isConstructor(): bool |
49
|
|
|
{ |
50
|
15 |
|
return $this->name === '__construct'; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** @return Parameter[] */ |
54
|
16 |
|
public function parameters(): array |
55
|
|
|
{ |
56
|
16 |
|
return $this->parameters; |
57
|
|
|
} |
58
|
|
|
|
59
|
15 |
|
public function __toString(): string |
60
|
|
|
{ |
61
|
15 |
|
return sprintf( |
62
|
|
|
'%s%s%s%s', |
63
|
15 |
|
$this->visibility->value, |
64
|
15 |
|
$this->name, |
65
|
15 |
|
$this->parameters === [] ? '()' : '(' . implode(', ', $this->parameters) . ')', |
66
|
15 |
|
$this->returnType->isPresent() ? ": {$this->returnType}" : '' |
67
|
|
|
); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|
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