From 63edb3b9a5f18a8464f2568ae37df442f4378c74 Mon Sep 17 00:00:00 2001 From: Daniel Carbone Date: Wed, 21 Aug 2024 21:33:25 -0500 Subject: [PATCH] more efficient collection setter implementation --- template/types/properties/methods/default.php | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/template/types/properties/methods/default.php b/template/types/properties/methods/default.php index 116c09c7..ba736912 100644 --- a/template/types/properties/methods/default.php +++ b/template/types/properties/methods/default.php @@ -204,11 +204,11 @@ public function getSetterName(); ?>( * - * @param getValueFHIRType()->getFullyQualifiedClassName(true); ?>[] $ + * @param getValueFHIRType()->getFullyQualifiedClassName(true); ?> ...$ * @return static */ - public function set(array $ = []): self + public function set(getValueFHIRType()->getClassName(); ?> ...$): self { if ([] !== $this->) { $this->_trackValuesRemoved(count($this->)); @@ -218,21 +218,7 @@ public function set(array $ as $v) { - if (is_object($v)) { - if ($v instanceof getValueFHIRType()->getClassName(); ?>) { - $this->getSetterName(); ?>($v); - } else { - throw new \InvalidArgumentException(sprintf( - 'getClassName(); ?> - Field "" must be an array of objects implementing getValueFHIRType()->getClassName(); ?>, object of type %s seen', - get_class($v) - )); - } - } else { - throw new \InvalidArgumentException(sprintf( - 'getClassName(); ?> - Unable to set value for field "" from value: %s', - json_encode($v) - )); - } + $this->getSetterName(); ?>($v); } return $this; }