Skip to content

Commit b2c50d3

Browse files
refactor: throw RuntimeException if list contains multiple equal entries
refs #25
1 parent af225f4 commit b2c50d3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Data/ParameterList.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ public function toArray(): array
4242
$data = [];
4343

4444
foreach ($this->data as $parameter) {
45+
if (array_key_exists($parameter->getName(), $data)) {
46+
/**
47+
* @see https://github.com/conjoon/php-lib-conjoon/issues/25
48+
*/
49+
throw new RuntimeException("\"" . $parameter->getName() . "\" already in list");
50+
}
4551
$data[$parameter->getName()] = $parameter->getValue();
4652
}
4753

0 commit comments

Comments
 (0)