Skip to content

Commit b17b544

Browse files
committed
PHPStan Updates.
1 parent 71be476 commit b17b544

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/Dialogue/Confirm.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
*/
1111
class Confirm extends Dialogue
1212
{
13+
/**
14+
* @var bool
15+
*/
1316
private $confirm = true;
1417

1518
/**
@@ -33,7 +36,6 @@ public function display(string $confirmText = 'OK', string $cancelText = 'Cancel
3336
$this->drawDialog($confirmText, $cancelText);
3437
}
3538
}
36-
return false;
3739
}
3840

3941
private function drawDialog(string $confirmText = 'OK', string $cancelText = 'Cancel'): void
@@ -73,9 +75,9 @@ private function drawDialog(string $confirmText = 'OK', string $cancelText = 'Ca
7375
$pad = ($buttonLength - $promptWidth) / 2;
7476
$this->text = sprintf(
7577
'%s%s%s',
76-
str_repeat(' ', round($pad, 0, 2) + $this->style->getPaddingLeftRight()),
78+
str_repeat(' ', intval(round($pad, 0, 2) + $this->style->getPaddingLeftRight())),
7779
$this->text,
78-
str_repeat(' ', round($pad, 0, 1) + $this->style->getPaddingLeftRight())
80+
str_repeat(' ', intval(round($pad, 0, 1) + $this->style->getPaddingLeftRight()))
7981
);
8082
$promptWidth = mb_strlen($this->text) + 4;
8183
}

src/Input/InputIO.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function (string $line) {
108108
},
109109
$lines
110110
)
111-
);
111+
) ? : 0;
112112
}
113113

114114
private function calculateYPosition() : int

src/MenuStyle.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ private function generatePaddingTopBottomRows() : void
509509
);
510510
}
511511

512+
$this->paddingTopBottom = $this->paddingTopBottom >= 0 ? $this->paddingTopBottom : 0;
512513
$this->paddingTopBottomRows = array_fill(0, $this->paddingTopBottom, $paddingRow);
513514
}
514515

@@ -663,6 +664,10 @@ private function generateBorderRows() : void
663664
);
664665
}
665666

667+
$this->borderTopWidth = $this->borderTopWidth >= 0 ? $this->borderTopWidth : 0;
668+
$this->borderBottomWidth = $this->borderBottomWidth >= 0 ? $this->borderBottomWidth : 0;
669+
670+
666671
$this->borderTopRows = array_fill(0, $this->borderTopWidth, $borderRow);
667672
$this->borderBottomRows = array_fill(0, $this->borderBottomWidth, $borderRow);
668673
}

0 commit comments

Comments
 (0)