bug #26298 Fix ArrayInput::toString() for InputArgument::IS_ARRAY args (maximium)
This PR was merged into the 2.7 branch.
Discussion
----------
Fix ArrayInput::toString() for InputArgument::IS_ARRAY args
| Q | A
| ------------- | ---
| Branch? | 2.7 up to 4.0
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Fix ArrayInput::toString() method to eliminate 'Array to string conversion' notice and get right string representation of InputArgument::IS_ARRAY argument. It need to be fixed in all branches up to master.
Commits
-------
f371fd8
Fix ArrayInput::toString() for InputArgument::IS_ARRAY args
This commit is contained in:
commit
25f3eb5cdd
@ -103,7 +103,7 @@ class ArrayInput extends Input
|
||||
$params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
|
||||
}
|
||||
} else {
|
||||
$params[] = is_array($val) ? array_map(array($this, 'escapeToken'), $val) : $this->escapeToken($val);
|
||||
$params[] = is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,5 +143,8 @@ class ArrayInputTest extends TestCase
|
||||
|
||||
$input = new ArrayInput(array('-b' => array('bval_1', 'bval_2'), '--f' => array('fval_1', 'fval_2')));
|
||||
$this->assertSame('-b=bval_1 -b=bval_2 --f=fval_1 --f=fval_2', (string) $input);
|
||||
|
||||
$input = new ArrayInput(array('array_arg' => array('val_1', 'val_2')));
|
||||
$this->assertSame('val_1 val_2', (string) $input);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user