@@ -41,8 +41,7 @@ trait HasSharedLogic
41
41
/**
42
42
* Set the recipient's Chat ID.
43
43
*
44
- * @param int|string $chatId The unique identifier for the target chat
45
- * @return static
44
+ * @param int|string $chatId The unique identifier for the target chat
46
45
*/
47
46
public function to (int |string $ chatId ): static
48
47
{
@@ -54,9 +53,9 @@ public function to(int|string $chatId): static
54
53
/**
55
54
* Set the keyboard markup for the message.
56
55
*
57
- * @param array<string, mixed> $markup The keyboard markup array
56
+ * @param array<string, mixed> $markup The keyboard markup array
57
+ *
58
58
* @throws JsonException When JSON encoding fails
59
- * @return static
60
59
*/
61
60
public function keyboardMarkup (array $ markup ): static
62
61
{
@@ -67,8 +66,6 @@ public function keyboardMarkup(array $markup): static
67
66
68
67
/**
69
68
* Unset parse mode of the message.
70
- *
71
- * @return static
72
69
*/
73
70
public function normal (): static
74
71
{
@@ -80,8 +77,7 @@ public function normal(): static
80
77
/**
81
78
* Set the parse mode of the message.
82
79
*
83
- * @param ParseMode|null $mode The parse mode to use
84
- * @return static
80
+ * @param ParseMode|null $mode The parse mode to use
85
81
*/
86
82
public function parseMode (?ParseMode $ mode = null ): static
87
83
{
@@ -93,12 +89,12 @@ public function parseMode(?ParseMode $mode = null): static
93
89
/**
94
90
* Add a normal keyboard button.
95
91
*
96
- * @param string $text The text to display on the button
97
- * @param int $columns Number of columns for button layout
98
- * @param bool $requestContact Whether to request user's contact
99
- * @param bool $requestLocation Whether to request user's location
92
+ * @param string $text The text to display on the button
93
+ * @param int $columns Number of columns for button layout
94
+ * @param bool $requestContact Whether to request user's contact
95
+ * @param bool $requestLocation Whether to request user's location
96
+ *
100
97
* @throws JsonException When JSON encoding fails
101
- * @return static
102
98
*/
103
99
public function keyboard (
104
100
string $ text ,
@@ -124,11 +120,11 @@ public function keyboard(
124
120
/**
125
121
* Add an inline button with URL.
126
122
*
127
- * @param string $text The text to display on the button
128
- * @param string $url The URL to open when button is pressed
129
- * @param int $columns Number of columns for button layout
123
+ * @param string $text The text to display on the button
124
+ * @param string $url The URL to open when button is pressed
125
+ * @param int $columns Number of columns for button layout
126
+ *
130
127
* @throws JsonException When JSON encoding fails
131
- * @return static
132
128
*/
133
129
public function button (string $ text , string $ url , int $ columns = 2 ): static
134
130
{
@@ -140,11 +136,11 @@ public function button(string $text, string $url, int $columns = 2): static
140
136
/**
141
137
* Add an inline button with callback data.
142
138
*
143
- * @param string $text The text to display on the button
144
- * @param string $callbackData The data to send when button is pressed
145
- * @param int $columns Number of columns for button layout
139
+ * @param string $text The text to display on the button
140
+ * @param string $callbackData The data to send when button is pressed
141
+ * @param int $columns Number of columns for button layout
142
+ *
146
143
* @throws JsonException When JSON encoding fails
147
- * @return static
148
144
*/
149
145
public function buttonWithCallback (string $ text , string $ callbackData , int $ columns = 2 ): static
150
146
{
@@ -159,11 +155,11 @@ public function buttonWithCallback(string $text, string $callbackData, int $colu
159
155
/**
160
156
* Add an inline button with web app.
161
157
*
162
- * @param string $text The text to display on the button
163
- * @param string $url The URL of the Web App to open
164
- * @param int $columns Number of columns for button layout
158
+ * @param string $text The text to display on the button
159
+ * @param string $url The URL of the Web App to open
160
+ * @param int $columns Number of columns for button layout
161
+ *
165
162
* @throws JsonException When JSON encoding fails
166
- * @return static
167
163
*/
168
164
public function buttonWithWebApp (string $ text , string $ url , int $ columns = 2 ): static
169
165
{
@@ -178,8 +174,7 @@ public function buttonWithWebApp(string $text, string $url, int $columns = 2): s
178
174
/**
179
175
* Send the message silently. Users will receive a notification with no sound.
180
176
*
181
- * @param bool $disable Whether to disable the notification sound
182
- * @return static
177
+ * @param bool $disable Whether to disable the notification sound
183
178
*/
184
179
public function disableNotification (bool $ disable = true ): static
185
180
{
@@ -191,8 +186,7 @@ public function disableNotification(bool $disable = true): static
191
186
/**
192
187
* Set the Bot Token. Overrides default bot token with the given value for this notification.
193
188
*
194
- * @param string $token The bot token to use
195
- * @return static
189
+ * @param string $token The bot token to use
196
190
*/
197
191
public function token (string $ token ): static
198
192
{
@@ -203,8 +197,6 @@ public function token(string $token): static
203
197
204
198
/**
205
199
* Determine if bot token is given for this notification.
206
- *
207
- * @return bool
208
200
*/
209
201
public function hasToken (): bool
210
202
{
@@ -214,8 +206,7 @@ public function hasToken(): bool
214
206
/**
215
207
* Set additional options to pass to sendMessage method.
216
208
*
217
- * @param array<string, mixed> $options Additional options
218
- * @return static
209
+ * @param array<string, mixed> $options Additional options
219
210
*/
220
211
public function options (array $ options ): static
221
212
{
@@ -231,8 +222,7 @@ public function options(array $options): static
231
222
* which will be invoked if an exception occurs during the
232
223
* notification process. The callback must be a valid Closure.
233
224
*
234
- * @param Closure $callback The closure that will handle exceptions.
235
- * @return self
225
+ * @param Closure $callback The closure that will handle exceptions.
236
226
*/
237
227
public function onError (Closure $ callback ): self
238
228
{
@@ -244,20 +234,17 @@ public function onError(Closure $callback): self
244
234
/**
245
235
* Set a condition for sending the message.
246
236
*
247
- * @param bool|callable $condition The condition to evaluate
248
- * @return static
237
+ * @param bool|callable $condition The condition to evaluate
249
238
*/
250
239
public function sendWhen (bool |callable $ condition ): static
251
240
{
252
- $ this ->sendCondition = $ this ->when ($ condition , fn () => true , fn () => false );
241
+ $ this ->sendCondition = $ this ->when ($ condition , fn () => true , fn () => false );
253
242
254
243
return $ this ;
255
244
}
256
245
257
246
/**
258
247
* Determine if the message can be sent based on the condition.
259
- *
260
- * @return bool
261
248
*/
262
249
public function canSend (): bool
263
250
{
@@ -266,18 +253,16 @@ public function canSend(): bool
266
253
267
254
/**
268
255
* Determine if chat id is not given.
269
- *
270
- * @return bool
271
256
*/
272
257
public function toNotGiven (): bool
273
258
{
274
- return !isset ($ this ->payload ['chat_id ' ]);
259
+ return ! isset ($ this ->payload ['chat_id ' ]);
275
260
}
276
261
277
262
/**
278
263
* Get payload value for given key.
279
264
*
280
- * @param string $key The key to retrieve from payload
265
+ * @param string $key The key to retrieve from payload
281
266
* @return mixed The value from payload or null if not found
282
267
*/
283
268
public function getPayloadValue (string $ key ): mixed
@@ -308,9 +293,9 @@ public function jsonSerialize(): array
308
293
/**
309
294
* Update the inline keyboard markup.
310
295
*
311
- * @param int $columns Number of columns for button layout
296
+ * @param int $columns Number of columns for button layout
297
+ *
312
298
* @throws JsonException When JSON encoding fails
313
- * @return static
314
299
*/
315
300
private function updateInlineKeyboard (int $ columns ): static
316
301
{
0 commit comments