From 937f67102a3a8d7422b24d11b84873240db51ffe Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 22 Jul 2023 13:57:53 +0200 Subject: [PATCH] Fixes to logger updateSettings, getReply and FilterReplyToSelf. --- src/EventHandler/AbstractMessage.php | 2 +- src/EventHandler/Filter/FilterReplyToSelf.php | 2 +- src/Settings/Logger.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EventHandler/AbstractMessage.php b/src/EventHandler/AbstractMessage.php index 019f6bf0f..4dd32697f 100644 --- a/src/EventHandler/AbstractMessage.php +++ b/src/EventHandler/AbstractMessage.php @@ -119,7 +119,7 @@ abstract class AbstractMessage extends Update implements SimpleFilters */ public function getReply(string $class = AbstractMessage::class): ?self { - if (!\is_subclass_of($class, AbstractMessage::class)) { + if ($class !== AbstractMessage::class && !\is_subclass_of($class, AbstractMessage::class)) { throw new AssertionError("A class that extends AbstractMessage was expected."); } if ($this->replyToMsgId === null) { diff --git a/src/EventHandler/Filter/FilterReplyToSelf.php b/src/EventHandler/Filter/FilterReplyToSelf.php index 740f07602..63fc766f7 100644 --- a/src/EventHandler/Filter/FilterReplyToSelf.php +++ b/src/EventHandler/Filter/FilterReplyToSelf.php @@ -14,6 +14,6 @@ final class FilterReplyToSelf extends Filter { public function apply(Update $update): bool { - return $update instanceof Message && $update->getReply()->out; + return $update instanceof Message && $update->getReply()?->out; } } diff --git a/src/Settings/Logger.php b/src/Settings/Logger.php index 3ac4977df..ee5ce8429 100644 --- a/src/Settings/Logger.php +++ b/src/Settings/Logger.php @@ -98,8 +98,8 @@ final class Logger extends SettingsAbstract public function __sleep() { return $this->extra instanceof Closure - ? ['type', 'extra', 'level', 'maxSize'] - : ['type', 'level', 'maxSize']; + ? ['type', 'level', 'maxSize'] + : ['type', 'extra', 'level', 'maxSize']; } /** * Wakeup function.