|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace AlecRabbit\Spinner\Core\Config\Builder; |
|
6
|
|
|
|
|
7
|
|
|
use AlecRabbit\Spinner\Contract\Mode\AutoStartMode; |
|
8
|
|
|
use AlecRabbit\Spinner\Contract\Mode\SignalHandlingMode; |
|
9
|
|
|
use AlecRabbit\Spinner\Core\Config\Contract\Builder\ILoopConfigBuilder; |
|
10
|
|
|
use AlecRabbit\Spinner\Core\Config\Contract\ILoopConfig; |
|
11
|
|
|
use AlecRabbit\Spinner\Core\Config\LoopConfig; |
|
|
|
|
|
|
12
|
|
|
use AlecRabbit\Spinner\Core\Contract\ISignalHandlersContainer; |
|
13
|
|
|
use AlecRabbit\Spinner\Exception\LogicException; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @psalm-suppress PossiblyNullArgument |
|
17
|
|
|
*/ |
|
18
|
|
|
final class LoopConfigBuilder implements ILoopConfigBuilder |
|
19
|
|
|
{ |
|
20
|
|
|
private ?AutoStartMode $autoStartMode = null; |
|
21
|
|
|
private ?SignalHandlingMode $signalHandlersMode = null; |
|
22
|
|
|
private ?ISignalHandlersContainer $signalHandlersContainer = null; |
|
23
|
|
|
|
|
24
|
|
|
public function build(): ILoopConfig |
|
25
|
|
|
{ |
|
26
|
|
|
$this->validate(); |
|
27
|
|
|
|
|
28
|
|
|
return new LoopConfig( |
|
29
|
|
|
autoStartMode: $this->autoStartMode, |
|
30
|
|
|
signalHandlersMode: $this->signalHandlersMode, |
|
31
|
|
|
signalHandlersContainer: $this->signalHandlersContainer, |
|
32
|
|
|
); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @throws LogicException |
|
37
|
|
|
*/ |
|
38
|
|
|
private function validate(): void |
|
39
|
|
|
{ |
|
40
|
|
|
match (true) { |
|
41
|
|
|
$this->autoStartMode === null => throw new LogicException('AutoStartMode is not set.'), |
|
42
|
|
|
$this->signalHandlersMode === null => throw new LogicException('SignalHandlingMode is not set.'), |
|
43
|
|
|
$this->signalHandlersContainer === null => throw new LogicException( |
|
44
|
|
|
'Signal handlers container is not set.' |
|
45
|
|
|
), |
|
46
|
|
|
default => null, |
|
47
|
|
|
}; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function withAutoStartMode(AutoStartMode $autoStartMode): ILoopConfigBuilder |
|
51
|
|
|
{ |
|
52
|
|
|
$clone = clone $this; |
|
53
|
|
|
$clone->autoStartMode = $autoStartMode; |
|
54
|
|
|
return $clone; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function withSignalHandlingMode(SignalHandlingMode $signalHandlersMode): ILoopConfigBuilder |
|
58
|
|
|
{ |
|
59
|
|
|
$clone = clone $this; |
|
60
|
|
|
$clone->signalHandlersMode = $signalHandlersMode; |
|
61
|
|
|
return $clone; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function withSignalHandlersContainer(ISignalHandlersContainer $signalHandlersContainer): ILoopConfigBuilder |
|
65
|
|
|
{ |
|
66
|
|
|
$clone = clone $this; |
|
67
|
|
|
$clone->signalHandlersContainer = $signalHandlersContainer; |
|
68
|
|
|
return $clone; |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
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