From: Vincent Vanwaelscappel Date: Wed, 22 Sep 2021 10:06:25 +0000 (+0200) Subject: wip #4697 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=cbfc2bde5cfd950b1cd3040b5e5ca4a6dc327fe5;p=cubist_util.git wip #4697 @0.25 --- diff --git a/src/ArrayUtil.php b/src/ArrayUtil.php index aef58b4..7a602a4 100644 --- a/src/ArrayUtil.php +++ b/src/ArrayUtil.php @@ -121,6 +121,10 @@ class ArrayUtil { } } + /** + * @param $input + * @return array + */ public static function asArray($input) { if (is_array($input)) { return $input; @@ -128,7 +132,7 @@ class ArrayUtil { if (is_object($input)) { return ObjectUtil::toArray($input); } - return array($input); + return [$input]; } public static function array_key_exists_recursive($needle, $haystack) { diff --git a/src/ObjectUtil.php b/src/ObjectUtil.php index cbc196b..941d2ec 100644 --- a/src/ObjectUtil.php +++ b/src/ObjectUtil.php @@ -5,6 +5,10 @@ class ObjectUtil { protected $_orderOnProperty = null; protected $_orderOnIsMethod = false; + /** + * @param $o + * @return array + */ public static function toArray($o) { if (is_array($o)) { return $o;