1 | <?php |
||
11 | class Executor implements ExecutorContract |
||
12 | { |
||
13 | protected $artisanCommand; |
||
14 | |||
15 | 138 | public function __construct(Command $artisanCommand) |
|
19 | |||
20 | 132 | public function exec(array $commands) |
|
26 | |||
27 | 60 | public function artisan(string $command, array $arguments = []) |
|
31 | |||
32 | 12 | public function external(string $command, array $arguments = []) |
|
33 | { |
||
34 | 12 | $Process = new Process(empty($arguments) ? $command : array_merge([$command], $arguments)); |
|
|
|||
35 | 12 | $Process->setTimeout(null); |
|
36 | |||
37 | 12 | if (Process::isTtySupported()) { |
|
38 | 12 | $Process->setTty(true); |
|
39 | } elseif (Process::isPtySupported()) { |
||
40 | $Process->setPty(true); |
||
41 | } |
||
42 | $Process->run(function ($type, $buffer) { |
||
43 | if (Process::ERR === $type) { |
||
44 | $this->artisanCommand->error($buffer); |
||
45 | } else { |
||
46 | $this->artisanCommand->line($buffer); |
||
47 | } |
||
48 | 12 | }); |
|
49 | 12 | } |
|
50 | |||
51 | 6 | public function callable(callable $function, array $arguments = []) |
|
58 | |||
59 | 48 | public function dispatch($job) |
|
63 | |||
64 | 12 | public function dispatchNow($job) |
|
68 | |||
69 | 54 | protected function printJob($job, $result) |
|
77 | } |
||
78 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.