@@ -10,9 +10,9 @@ abstract class KeyboardMarkup extends FluentEntity
1010 *
1111 * @var string
1212 */
13- protected static $ keyboardFieldName = 'keyboard ' ;
13+ protected static string $ keyboardFieldName = 'keyboard ' ;
1414
15- protected $ currentRowIndex = 0 ;
15+ protected int $ currentRowIndex = 0 ;
1616
1717 public function __construct (array $ data = [])
1818 {
@@ -32,13 +32,13 @@ public function row(array $buttons = []): self
3232 {
3333 $ keyboard = &$ this ->data [static ::$ keyboardFieldName ];
3434
35- // Last row is not empty
35+ // Last row is not empty, add new row
3636 if (! empty ($ keyboard [$ this ->currentRowIndex ])) {
3737 $ keyboard [] = [];
3838 $ this ->currentRowIndex ++;
3939 }
4040
41- // argument is not empty
41+ // Buttons have been passed, add them
4242 if (! empty ($ buttons )) {
4343 $ keyboard [$ this ->currentRowIndex ] = $ buttons ;
4444 $ this ->currentRowIndex ++;
@@ -48,14 +48,13 @@ public function row(array $buttons = []): self
4848 }
4949
5050 /**
51- * Adds buttons one per row to the keyboard.
51+ * Adds buttons to the keyboard, one per row .
5252 *
5353 * @param Button[] $buttons
5454 * @return $this
5555 */
5656 public function stack (array $ buttons ): self
5757 {
58- // Every button gets its own row
5958 foreach ($ buttons as $ button ) {
6059 $ this ->row ([$ button ]);
6160 }
0 commit comments