This commit is contained in:
2021-07-21 14:11:20 +08:00
parent fd51902c31
commit 98cf8ff17d
+3 -3
View File
@@ -27,9 +27,6 @@ abstract class Server
*/ */
public function setEvents(string $name, ?array $events): void public function setEvents(string $name, ?array $events): void
{ {
if (!is_callable($events)) {
return;
}
if (is_array($events) && is_string($events[0])) { if (is_array($events) && is_string($events[0])) {
$reflect = Snowflake::getDi()->getReflect($events[0]); $reflect = Snowflake::getDi()->getReflect($events[0]);
if (!$reflect) { if (!$reflect) {
@@ -37,6 +34,9 @@ abstract class Server
} }
$events[0] = $reflect->newInstance(); $events[0] = $reflect->newInstance();
} }
if (!is_callable($events)) {
return;
}
$this->_events[$name] = $events; $this->_events[$name] = $events;
} }