Skip to content

Commit 8f90cbb

Browse files
committed
Config::processLongArgument(): fix storing of unknown arguments
These arguments should be stored in the `unknown` property. There is no `values` property. Note: the read/write logic is to prevent a `Indirect modification of overloaded property PHP_CodeSniffer\Config::$unknown has no effect` PHP notice.
1 parent 5ef2b66 commit 8f90cbb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Config.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,13 +1219,17 @@ public function processLongArgument($arg, $pos)
12191219
if ($this->dieOnUnknownArg === false) {
12201220
$eqPos = strpos($arg, '=');
12211221
try {
1222+
$unknown = $this->unknown;
1223+
12221224
if ($eqPos === false) {
1223-
$this->values[$arg] = $arg;
1225+
$unknown[$arg] = $arg;
12241226
} else {
1225-
$value = substr($arg, ($eqPos + 1));
1226-
$arg = substr($arg, 0, $eqPos);
1227-
$this->values[$arg] = $value;
1227+
$value = substr($arg, ($eqPos + 1));
1228+
$arg = substr($arg, 0, $eqPos);
1229+
$unknown[$arg] = $value;
12281230
}
1231+
1232+
$this->unknown = $unknown;
12291233
} catch (RuntimeException $e) {
12301234
// Value is not valid, so just ignore it.
12311235
}

0 commit comments

Comments
 (0)