1 | <?php |
||
16 | class Exec |
||
17 | { |
||
18 | /** |
||
19 | * @var string[] |
||
20 | */ |
||
21 | private $prefixes; |
||
22 | /** |
||
23 | * @var string[] |
||
24 | */ |
||
25 | private $output; |
||
26 | /** |
||
27 | * @var int |
||
28 | */ |
||
29 | private $status; |
||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $lastCommand; |
||
34 | |||
35 | /** |
||
36 | * Create a new callable `Exec` object. |
||
37 | * |
||
38 | * @param string[] $prefixes,... Optional arguments will always be added to the beginning of the command. |
||
|
|||
39 | * |
||
40 | * @return \nochso\Omni\Exec |
||
41 | */ |
||
42 | public static function create(...$prefixes) |
||
48 | |||
49 | /** |
||
50 | * Run a command with auto-escaped arguments. |
||
51 | * |
||
52 | * @param string[] $arguments,... Optional arguments will be added after the prefixes. |
||
53 | * |
||
54 | * @return $this |
||
55 | */ |
||
56 | public function run(...$arguments) |
||
64 | |||
65 | /** |
||
66 | * getCommand returns the string to be used by `\exec()`. |
||
67 | * |
||
68 | * @param string[] $arguments,... |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | public function getCommand(...$arguments) |
||
85 | |||
86 | /** |
||
87 | * getLastCommand returns the string last used by a previous call to `run()`. |
||
88 | * |
||
89 | * @return string|null |
||
90 | */ |
||
91 | public function getLastCommand() |
||
95 | |||
96 | /** |
||
97 | * getOutput of last execution. |
||
98 | * |
||
99 | * @return string[] |
||
100 | */ |
||
101 | public function getOutput() |
||
105 | |||
106 | /** |
||
107 | * getStatus code of last execution. |
||
108 | * |
||
109 | * @return int |
||
110 | */ |
||
111 | public function getStatus() |
||
115 | |||
116 | /** |
||
117 | * __invoke allows using this object as a callable by calling `run()`. |
||
118 | * |
||
119 | * e.g. `$runner('argument');` |
||
120 | * |
||
121 | * @param array $arguments,... |
||
122 | * |
||
123 | * @return \nochso\Omni\Exec |
||
124 | */ |
||
125 | public function __invoke(...$arguments) |
||
129 | |||
130 | /** |
||
131 | * @param string $argument |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | private function escapeArgument($argument) |
||
146 | |||
147 | /** |
||
148 | * @param string $argument |
||
149 | * |
||
150 | * @return string |
||
151 | * |
||
152 | * @link https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ |
||
153 | */ |
||
154 | private function escapeLinuxArgument($argument) |
||
167 | |||
168 | /** |
||
169 | * @param string $argument |
||
170 | * |
||
171 | * @return string |
||
172 | */ |
||
173 | private function escapeWindowsArgument($argument) |
||
202 | } |
||
203 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.