Skip to content

Commit 502270e

Browse files
committed
Ensure Config::$validGenerators is not changed as it will be converted
to a class constant in the future
1 parent 541e2ef commit 502270e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Config.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,15 +1252,14 @@ public function processLongArgument($arg, $pos)
12521252
$lowerCaseGeneratorName = strtolower($generatorName);
12531253

12541254
if (isset($this->validGenerators[$lowerCaseGeneratorName]) === false) {
1255-
$lastOption = array_pop($this->validGenerators);
1256-
$validOptions = implode(', ', $this->validGenerators);
1257-
$validOptions .= ' and '.$lastOption;
1258-
$error = sprintf(
1255+
$validOptions = implode(', ', $this->validGenerators);
1256+
$validOptions = substr_replace($validOptions, ' and', strrpos($validOptions, ','), 1);
1257+
$error = sprintf(
12591258
'ERROR: "%s" is not a valid generator. The following generators are supported: %s.'.PHP_EOL.PHP_EOL,
12601259
$generatorName,
12611260
$validOptions
12621261
);
1263-
$error .= $this->printShortUsage(true);
1262+
$error .= $this->printShortUsage(true);
12641263
throw new DeepExitException($error, 3);
12651264
}
12661265

0 commit comments

Comments
 (0)