From 48302c5067d1c0ed615c0a5bd43ea0428a667fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Mar 2021 18:55:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Abstracts/BaseApplication.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/System/Abstracts/BaseApplication.php b/System/Abstracts/BaseApplication.php index 351b7071..23719c97 100644 --- a/System/Abstracts/BaseApplication.php +++ b/System/Abstracts/BaseApplication.php @@ -186,10 +186,20 @@ abstract class BaseApplication extends Service throw new InitException("Class {$value} does not exists."); } $value = Snowflake::createObject($value); - } else if (is_array($value) && !is_callable($value, true)) { - throw new InitException("Class does not hav callback."); } - $event->on($key, $value); + if (is_array($value) && isset($value[0]) && is_object($value[0])) { + if (!is_callable($value, true)) { + throw new InitException("Class does not hav callback."); + } + $event->on($key, $value); + } else { + foreach ($value as $item) { + if (!is_callable($item, true)) { + throw new InitException("Class does not hav callback."); + } + $event->on($key, $item); + } + } } }