Conditions | 5 |
Paths | 2 |
Total Lines | 57 |
Code Lines | 34 |
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 |
||
44 | public function execute(InputInterface $input, OutputInterface $output): int |
||
45 | { |
||
46 | /** @var string $target_regex */ |
||
47 | $target_regex = '{' . ($input->getOption('target-regex') ?? '^php-fpm') . '}'; |
||
48 | $context = Context\create(__DIR__ . '/Worker/php-searcher.php'); |
||
49 | /** @var int $searcher_pid */ |
||
50 | $searcher_pid = Promise\wait($context->start()); |
||
51 | Promise\wait($context->send($target_regex)); |
||
52 | /** @var int[] $pid_list */ |
||
53 | $pid_list = Promise\wait($context->receive()); |
||
54 | $readers = []; |
||
55 | foreach ($pid_list as $pid) { |
||
56 | $context = Context\create(__DIR__ . '/Worker/php-reader.php'); |
||
57 | Promise\wait($context->start()); |
||
58 | Promise\wait($context->send($pid)); |
||
59 | $readers[$pid] = $context; |
||
60 | } |
||
61 | exec('stty -icanon -echo'); |
||
62 | |||
63 | Loop::run(function () use (&$readers, $output) { |
||
64 | Loop::onReadable( |
||
65 | STDIN, |
||
66 | /** @param resource $stream */ |
||
67 | function (string $watcher_id, $stream) { |
||
68 | $key = fread($stream, 1); |
||
69 | if ($key === 'q') { |
||
70 | Loop::cancel($watcher_id); |
||
71 | Loop::stop(); |
||
72 | } |
||
73 | } |
||
74 | ); |
||
75 | Loop::repeat(10, function () use (&$readers, $output) { |
||
76 | /** @var array<int, Context\Context> $readers */ |
||
77 | |||
78 | $promises = []; |
||
79 | foreach ($readers as $pid => $reader) { |
||
80 | if (!$reader->isRunning()) { |
||
81 | /** @psalm-suppress MixedArrayAccess*/ |
||
82 | unset($readers[$pid]); |
||
83 | continue; |
||
84 | } |
||
85 | $promises[] = \Amp\call( |
||
86 | function () use ($reader, &$readers, $pid, $output) { |
||
87 | /** @psalm-suppress MixedArrayAccess*/ |
||
88 | unset($readers[$pid]); |
||
89 | /** @var string $result */ |
||
90 | $result = yield $reader->receive(); |
||
91 | $output->write($result); |
||
92 | $readers[$pid] = $reader; |
||
93 | } |
||
94 | ); |
||
95 | } |
||
96 | yield $promises; |
||
97 | }); |
||
98 | }); |
||
99 | |||
100 | return 0; |
||
101 | } |
||
103 |
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