Skip to content

Commit d98c210

Browse files
committed
Fix ArrayInput::toString() for InputArgument::IS_ARRAY args
1 parent 3cdb34c commit d98c210

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Input/ArrayInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function __toString()
103103
$params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
104104
}
105105
} else {
106-
$params[] = is_array($val) ? array_map(array($this, 'escapeToken'), $val) : $this->escapeToken($val);
106+
$params[] = is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
107107
}
108108
}
109109

Tests/Input/ArrayInputTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,8 @@ public function testToString()
143143

144144
$input = new ArrayInput(array('-b' => array('bval_1', 'bval_2'), '--f' => array('fval_1', 'fval_2')));
145145
$this->assertSame('-b=bval_1 -b=bval_2 --f=fval_1 --f=fval_2', (string) $input);
146+
147+
$input = new ArrayInput(array('array_arg' => array('val_1', 'val_2')));
148+
$this->assertSame('val_1 val_2', (string) $input);
146149
}
147150
}

0 commit comments

Comments
 (0)