From cbfc2bde5cfd950b1cd3040b5e5ca4a6dc327fe5 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 22 Sep 2021 12:06:25 +0200 Subject: [PATCH] wip #4697 @0.25 --- src/ArrayUtil.php | 6 +++++- src/ObjectUtil.php | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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; -- 2.39.5