1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Spiral\Interceptors\Context; |
6
|
|
|
|
7
|
|
|
final class Target implements TargetInterface |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @param list<string> $path |
|
|
|
|
11
|
|
|
* @param \ReflectionFunctionAbstract|null $reflection |
12
|
|
|
*/ |
13
|
192 |
|
private function __construct( |
14
|
|
|
private ?array $path = null, |
15
|
|
|
private ?\ReflectionFunctionAbstract $reflection = null, |
16
|
|
|
private readonly string $delimiter = '.', |
17
|
|
|
) { |
18
|
192 |
|
} |
19
|
|
|
|
20
|
16 |
|
public function __toString(): string |
21
|
|
|
{ |
22
|
16 |
|
return match (true) { |
23
|
16 |
|
$this->path !== null => \implode($this->delimiter, $this->path), |
|
|
|
|
24
|
16 |
|
$this->reflection !== null => $this->reflection->getName(), |
|
|
|
|
25
|
16 |
|
}; |
26
|
|
|
} |
27
|
|
|
|
28
|
5 |
|
public static function fromReflection(\ReflectionFunctionAbstract $reflection): static |
29
|
|
|
{ |
30
|
5 |
|
return new self(reflection: $reflection); |
31
|
|
|
} |
32
|
|
|
|
33
|
7 |
|
public static function fromPathString(string $path, string $delimiter = '.'): static |
34
|
|
|
{ |
35
|
|
|
/** @psalm-suppress ArgumentTypeCoercion */ |
36
|
7 |
|
return new self(path: \explode($delimiter, $path), delimiter: $delimiter); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param list<string> $path |
41
|
|
|
*/ |
42
|
180 |
|
public static function fromPathArray(array $path, string $delimiter = '.'): static |
43
|
|
|
{ |
44
|
180 |
|
return new self(path: $path, delimiter: $delimiter); |
45
|
|
|
} |
46
|
|
|
|
47
|
178 |
|
public function getPath(): array |
48
|
|
|
{ |
49
|
178 |
|
return match (true) { |
50
|
178 |
|
$this->path !== null => $this->path, |
51
|
178 |
|
$this->reflection instanceof \ReflectionMethod => [ |
52
|
178 |
|
$this->reflection->getDeclaringClass()->getName(), |
|
|
|
|
53
|
178 |
|
$this->reflection->getName(), |
54
|
178 |
|
], |
55
|
178 |
|
$this->reflection instanceof \ReflectionFunction => [$this->reflection->getName()], |
56
|
178 |
|
default => [], |
57
|
178 |
|
}; |
58
|
|
|
} |
59
|
|
|
|
60
|
1 |
|
public function withPath(array $path): static |
61
|
|
|
{ |
62
|
1 |
|
$clone = clone $this; |
63
|
1 |
|
$clone->path = $path; |
|
|
|
|
64
|
1 |
|
return $clone; |
65
|
|
|
} |
66
|
|
|
|
67
|
10 |
|
public function getReflection(): ?\ReflectionFunctionAbstract |
68
|
|
|
{ |
69
|
10 |
|
return $this->reflection; |
70
|
|
|
} |
71
|
|
|
|
72
|
1 |
|
public function withReflection(?\ReflectionFunctionAbstract $reflection): static |
73
|
|
|
{ |
74
|
1 |
|
$clone = clone $this; |
75
|
1 |
|
$clone->reflection = $reflection; |
76
|
1 |
|
return $clone; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
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