mirror of
https://github.com/n3w/helpers-cli-input.git
synced 2025-12-19 20:53:27 +00:00
Fixed logic bug that prevented $index and $type from getting set when InputCollection::append() is called.
This commit is contained in:
parent
32ed646220
commit
866a2e1c9e
1 changed files with 2 additions and 5 deletions
|
|
@ -17,15 +17,12 @@ class InputCollection
|
|||
{
|
||||
$class = new \ReflectionClass($input);
|
||||
|
||||
$index = null;
|
||||
$type = null;
|
||||
|
||||
if (!$replace && null !== $this->find($input->name(), null, null, $index, $type)) {
|
||||
if (null !== $this->find($input->name(), null, null, $type, $index) && !$replace) {
|
||||
throw new \Exception("{$class->getShortName()} '{$input->name()}' already exists in this collection");
|
||||
}
|
||||
|
||||
if (true == $replace && null !== $index) {
|
||||
$this->items[$class->getShortName()][$index] = $argument;
|
||||
$this->items[$class->getShortName()][$index] = $input;
|
||||
} else {
|
||||
$this->items[$class->getShortName()][] = $input;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue