Conditions | 5 |
Paths | 2 |
Total Lines | 60 |
Code Lines | 37 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
97 | public function execute(InputInterface $input, OutputInterface $output): int |
||
98 | { |
||
99 | $target_php_settings = TargetPhpSettings::fromConsoleInput($input); |
||
100 | $loop_settings = TraceLoopSettings::fromConsoleInput($input); |
||
101 | $get_trace_settings = GetTraceSettings::fromConsoleInput($input); |
||
102 | $daemon_settings = DaemonSettings::fromConsoleInput($input); |
||
103 | |||
104 | $context = Context\create(__DIR__ . '/Worker/php-searcher.php'); |
||
105 | /** @var int $searcher_pid */ |
||
106 | $searcher_pid = Promise\wait($context->start()); |
||
107 | Promise\wait($context->send($daemon_settings->target_regex)); |
||
108 | /** @var int[] $pid_list */ |
||
109 | $pid_list = Promise\wait($context->receive()); |
||
110 | $readers = []; |
||
111 | foreach ($pid_list as $target_pid) { |
||
112 | $context = Context\create(__DIR__ . '/Worker/php-reader.php'); |
||
113 | Promise\wait($context->start()); |
||
114 | Promise\wait($context->send([$target_pid, $target_php_settings, $loop_settings, $get_trace_settings])); |
||
115 | $readers[$target_pid] = $context; |
||
116 | } |
||
117 | exec('stty -icanon -echo'); |
||
118 | |||
119 | Loop::run(function () use (&$readers, $output) { |
||
120 | Loop::onReadable( |
||
121 | STDIN, |
||
122 | /** @param resource $stream */ |
||
123 | function (string $watcher_id, $stream) { |
||
124 | $key = fread($stream, 1); |
||
125 | if ($key === 'q') { |
||
126 | Loop::cancel($watcher_id); |
||
127 | Loop::stop(); |
||
128 | } |
||
129 | } |
||
130 | ); |
||
131 | Loop::repeat(10, function () use (&$readers, $output) { |
||
132 | /** @var array<int, Context\Context> $readers */ |
||
133 | |||
134 | $promises = []; |
||
135 | foreach ($readers as $pid => $reader) { |
||
136 | if (!$reader->isRunning()) { |
||
137 | /** @psalm-suppress MixedArrayAccess*/ |
||
138 | unset($readers[$pid]); |
||
139 | continue; |
||
140 | } |
||
141 | $promises[] = \Amp\call( |
||
142 | function () use ($reader, &$readers, $pid, $output) { |
||
143 | /** @psalm-suppress MixedArrayAccess*/ |
||
144 | unset($readers[$pid]); |
||
145 | /** @var string $result */ |
||
146 | $result = yield $reader->receive(); |
||
147 | $output->write($result); |
||
148 | $readers[$pid] = $reader; |
||
149 | } |
||
150 | ); |
||
151 | } |
||
152 | yield $promises; |
||
153 | }); |
||
154 | }); |
||
155 | |||
156 | return 0; |
||
157 | } |
||
159 |
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