@@ -156,12 +156,15 @@ public function runTestJob(string $job, Test $test, string $processResultFile):
156
156
157
157
/**
158
158
* Returns the command based into the configurations.
159
+ *
160
+ * @return string[]
159
161
*/
160
- public function getCommand (array $ settings , ?string $ file = null ): string
162
+ public function getCommand (array $ settings , ?string $ file = null ): array
161
163
{
162
164
$ runtime = new Runtime ;
163
165
164
- $ command = $ runtime ->getBinary ();
166
+ $ command = [];
167
+ $ command [] = $ runtime ->getRawBinary ();
165
168
166
169
if ($ runtime ->hasPCOV ()) {
167
170
$ settings = array_merge (
@@ -179,29 +182,29 @@ public function getCommand(array $settings, ?string $file = null): string
179
182
);
180
183
}
181
184
182
- $ command .= $ this ->settingsToParameters ($ settings );
185
+ $ command = array_merge ( $ command , $ this ->settingsToParameters ($ settings) );
183
186
184
187
if (PHP_SAPI === 'phpdbg ' ) {
185
- $ command . = ' -qrr ' ;
188
+ $ command[] = '-qrr ' ;
186
189
187
190
if (!$ file ) {
188
- $ command . = 's= ' ;
191
+ $ command[] = 's= ' ;
189
192
}
190
193
}
191
194
192
195
if ($ file ) {
193
- $ command .= ' ' . escapeshellarg ( $ file) ;
196
+ $ command[] = $ file ;
194
197
}
195
198
196
199
if ($ this ->arguments ) {
197
200
if (!$ file ) {
198
- $ command . = ' -- ' ;
201
+ $ command[] = '-- ' ;
199
202
}
200
- $ command .= ' ' . $ this ->arguments ;
203
+ $ command[] = $ this ->arguments ;
201
204
}
202
205
203
206
if ($ this ->stderrRedirection ) {
204
- $ command . = ' 2>&1 ' ;
207
+ $ command[] = '2>&1 ' ;
205
208
}
206
209
207
210
return $ command ;
@@ -212,12 +215,17 @@ public function getCommand(array $settings, ?string $file = null): string
212
215
*/
213
216
abstract public function runJob (string $ job , array $ settings = []): array ;
214
217
215
- protected function settingsToParameters (array $ settings ): string
218
+ /**
219
+ * @param array $settings
220
+ * @return list<string>
221
+ */
222
+ protected function settingsToParameters (array $ settings ): array
216
223
{
217
- $ buffer = '' ;
224
+ $ buffer = [] ;
218
225
219
226
foreach ($ settings as $ setting ) {
220
- $ buffer .= ' -d ' . escapeshellarg ($ setting );
227
+ $ buffer [] = '-d ' ;
228
+ $ buffer [] = $ setting ;
221
229
}
222
230
223
231
return $ buffer ;
0 commit comments