From 866a2e1c9e57d7eebaae68819a5f4da3c3f7e109 Mon Sep 17 00:00:00 2001 From: Alannah Kearney Date: Mon, 27 May 2019 00:22:01 +1000 Subject: [PATCH] Fixed logic bug that prevented $index and $type from getting set when InputCollection::append() is called. --- src/Input/InputCollection.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Input/InputCollection.php b/src/Input/InputCollection.php index d307217..bf45252 100644 --- a/src/Input/InputCollection.php +++ b/src/Input/InputCollection.php @@ -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; }