From 4b971f84fd5b7f35d6463a92e5e675bd204aa480 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 5 Nov 2024 12:13:18 +0000 Subject: [PATCH] Fix returns in Console commands --- src/Console/Addon.php | 2 ++ src/Console/Contact.php | 5 +++-- src/Console/User.php | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Console/Addon.php b/src/Console/Addon.php index fd2093f9f5..43ce7a6be3 100644 --- a/src/Console/Addon.php +++ b/src/Console/Addon.php @@ -144,6 +144,8 @@ HELP; } $this->out($table->getTable()); + + return 0; } /** diff --git a/src/Console/Contact.php b/src/Console/Contact.php index e02f589714..46a26c4a9d 100644 --- a/src/Console/Contact.php +++ b/src/Console/Contact.php @@ -158,9 +158,10 @@ HELP; if ($result['success']) { $this->out('User ' . $user['nickname'] . ' now connected to ' . $url . ', contact ID ' . $result['cid']); - } else { - throw new RuntimeException($result['message']); + return true; } + + throw new RuntimeException($result['message']); } /** diff --git a/src/Console/User.php b/src/Console/User.php index b73311368a..42e85f007d 100644 --- a/src/Console/User.php +++ b/src/Console/User.php @@ -122,7 +122,7 @@ HELP; case 'search': return $this->searchUser(); case 'config': - return $this->configUser(); + return ($this->configUser()) ? 0 : 1; default: throw new \Asika\SimpleConsole\CommandArgsException('Wrong command.'); } @@ -513,6 +513,6 @@ HELP; return false; } - return false; + return true; } }