|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the sj-i/php-profiler package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) sji <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace PhpProfiler\Inspector\Daemon\Reader\Context; |
|
15
|
|
|
|
|
16
|
|
|
use Amp\Parallel\Context; |
|
|
|
|
|
|
17
|
|
|
use Amp\Promise; |
|
|
|
|
|
|
18
|
|
|
use PhpProfiler\Inspector\Daemon\Dispatcher\Message\DetachWorkerMessage; |
|
19
|
|
|
use PhpProfiler\Inspector\Daemon\Dispatcher\Message\TraceMessage; |
|
20
|
|
|
use PhpProfiler\Inspector\Daemon\Reader\Message\AttachMessage; |
|
21
|
|
|
use PhpProfiler\Inspector\Daemon\Reader\Message\SetSettingsMessage; |
|
22
|
|
|
use PhpProfiler\Inspector\Settings\GetTraceSettings; |
|
23
|
|
|
use PhpProfiler\Inspector\Settings\TargetPhpSettings; |
|
24
|
|
|
use PhpProfiler\Inspector\Settings\TraceLoopSettings; |
|
25
|
|
|
|
|
26
|
|
|
final class PhpReaderContext implements PhpReaderContextInterface |
|
27
|
|
|
{ |
|
28
|
|
|
private Context\Context $context; |
|
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
public function __construct(Context\Context $context) |
|
31
|
|
|
{ |
|
32
|
|
|
$this->context = $context; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function start(): Promise |
|
36
|
|
|
{ |
|
37
|
|
|
return $this->context->start(); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param TargetPhpSettings $target_php_settings |
|
42
|
|
|
* @param TraceLoopSettings $loop_settings |
|
43
|
|
|
* @param GetTraceSettings $get_trace_settings |
|
44
|
|
|
* @return Promise<int> |
|
45
|
|
|
*/ |
|
46
|
|
|
public function sendSettings( |
|
47
|
|
|
TargetPhpSettings $target_php_settings, |
|
48
|
|
|
TraceLoopSettings $loop_settings, |
|
49
|
|
|
GetTraceSettings $get_trace_settings |
|
50
|
|
|
): Promise { |
|
51
|
|
|
/** @var Promise<int> */ |
|
52
|
|
|
return $this->context->send( |
|
53
|
|
|
new SetSettingsMessage( |
|
54
|
|
|
$target_php_settings, |
|
55
|
|
|
$loop_settings, |
|
56
|
|
|
$get_trace_settings |
|
57
|
|
|
) |
|
58
|
|
|
); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @param int $pid |
|
63
|
|
|
* @return Promise<int> |
|
64
|
|
|
*/ |
|
65
|
|
|
public function sendAttach(int $pid): Promise |
|
66
|
|
|
{ |
|
67
|
|
|
/** @var Promise<int> */ |
|
68
|
|
|
return $this->context->send( |
|
69
|
|
|
new AttachMessage($pid) |
|
70
|
|
|
); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function isRunning(): bool |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->context->isRunning(); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @return Promise<TraceMessage|DetachWorkerMessage> |
|
80
|
|
|
* @psalm-yield Promise<TraceMessage|DetachWorkerMessage> |
|
81
|
|
|
*/ |
|
82
|
|
|
public function receiveTrace(): Promise |
|
83
|
|
|
{ |
|
84
|
|
|
/** @var Promise<TraceMessage|DetachWorkerMessage> */ |
|
85
|
|
|
return $this->context->receive(); |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|
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