From 87072414f8ab4c18c1e37a2984ad13b1566a2033 Mon Sep 17 00:00:00 2001 From: Imants Horsts Date: Fri, 20 Mar 2020 15:51:59 +0200 Subject: [PATCH] Update StaticAddToTrait.php --- src/StaticAddToTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/StaticAddToTrait.php b/src/StaticAddToTrait.php index 2c70696b..001ab0b5 100644 --- a/src/StaticAddToTrait.php +++ b/src/StaticAddToTrait.php @@ -112,15 +112,15 @@ private static function _addToWithClassName(object $parent, $seed, bool $unsafe, $seed = [$seed]; } - $cl = reset($seed); - if (key($seed) !== 0) { + if (!isset($seed[0])) { throw new Exception('Class name in seed is not defined'); } if (isset($parent->_factoryTrait)) { $object = $parent->factory($seed); } else { - unset($seed[key($seed)]); + $cl = $seed[0]; + unset($seed[0]); $object = new $cl(...$seed); } }