Skip to content

Commit abd4bfc

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 103a84d commit abd4bfc

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
@@ -1232,13 +1232,17 @@ public function processLongArgument($arg, $pos)
12321232
if ($this->dieOnUnknownArg === false) {
12331233
$eqPos = strpos($arg, '=');
12341234
try {
1235+
$unknown = $this->unknown;
1236+
12351237
if ($eqPos === false) {
1236-
$this->values[$arg] = $arg;
1238+
$unknown[$arg] = $arg;
12371239
} else {
1238-
$value = substr($arg, ($eqPos + 1));
1239-
$arg = substr($arg, 0, $eqPos);
1240-
$this->values[$arg] = $value;
1240+
$value = substr($arg, ($eqPos + 1));
1241+
$arg = substr($arg, 0, $eqPos);
1242+
$unknown[$arg] = $value;
12411243
}
1244+
1245+
$this->unknown = $unknown;
12421246
} catch (RuntimeException $e) {
12431247
// Value is not valid, so just ignore it.
12441248
}

0 commit comments

Comments
 (0)