1414use Github \Client ;
1515use Longman \TelegramBot \Entities \ServerResponse ;
1616use Longman \TelegramBot \Exception \TelegramException ;
17+ use Longman \TelegramBot \Request ;
1718use Longman \TelegramBot \Telegram ;
1819use Longman \TelegramBot \TelegramLog ;
1920use Monolog \Formatter \LineFormatter ;
6364 *
6465 * @param array $data
6566 */
66- function handleRelease ($ data ) {
67+ function handleRelease (array $ data ): void
68+ {
6769 $ repo = $ data ['repository ' ];
6870 $ release = $ data ['release ' ];
6971 $ action = $ data ['action ' ];
@@ -96,7 +98,8 @@ function handleRelease($data) {
9698 *
9799 * @return string
98100 */
99- function parseReleaseBody ($ body , $ user , $ repo ) {
101+ function parseReleaseBody ($ body , $ user , $ repo ): string
102+ {
100103 // Replace headers with bold text.
101104 $ body = preg_replace_callback ('~### (?<header>.*)~ ' , static function ($ matches ) {
102105 return "* {$ matches ['header ' ]}* " ;
@@ -142,7 +145,8 @@ function parseReleaseBody($body, $user, $repo) {
142145 *
143146 * @return ServerResponse|null
144147 */
145- function sendTelegramMessage ($ chat_id , $ text ) {
148+ function sendTelegramMessage ($ chat_id , $ text ): ?ServerResponse
149+ {
146150 try {
147151 new Telegram (getenv ('TG_API_KEY ' ));
148152
@@ -153,7 +157,7 @@ function sendTelegramMessage($chat_id, $text) {
153157
154158 $ parse_mode = 'markdown ' ;
155159
156- return Longman \ TelegramBot \ Request::sendMessage (compact ('chat_id ' , 'text ' , 'parse_mode ' ));
160+ return Request::sendMessage (compact ('chat_id ' , 'text ' , 'parse_mode ' ));
157161 } catch (TelegramException $ e ) {
158162 TelegramLog::error ($ e ->getMessage ());
159163 } catch (Throwable $ e ) {
0 commit comments