Skip to content

Commit 328e64a

Browse files
authored
Merge pull request #284 from zuuperman/master
2 parents b1cc7a3 + 2dcef6f commit 328e64a

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

src/Builder/CliMenuBuilder.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class CliMenuBuilder
9393
*/
9494
private $subMenu = false;
9595

96-
public function __construct(Terminal $terminal = null)
96+
public function __construct(?Terminal $terminal = null)
9797
{
9898
$this->terminal = $terminal ?? TerminalFactory::fromSystem();
9999
$this->style = new MenuStyle($this->terminal);
@@ -249,7 +249,7 @@ public function addSubMenuFromBuilder(string $text, CliMenuBuilder $builder) : s
249249
return $this;
250250
}
251251

252-
public function enableAutoShortcuts(string $regex = null) : self
252+
public function enableAutoShortcuts(?string $regex = null) : self
253253
{
254254
$this->autoShortcuts = true;
255255

@@ -373,14 +373,14 @@ public function setExitButtonText(string $exitButtonText) : self
373373
return $this;
374374
}
375375

376-
public function setBackgroundColour(string $colour, string $fallback = null) : self
376+
public function setBackgroundColour(string $colour, ?string $fallback = null) : self
377377
{
378378
$this->style->setBg($colour, $fallback);
379379

380380
return $this;
381381
}
382382

383-
public function setForegroundColour(string $colour, string $fallback = null) : self
383+
public function setForegroundColour(string $colour, ?string $fallback = null) : self
384384
{
385385
$this->style->setFg($colour, $fallback);
386386

@@ -394,7 +394,7 @@ public function setWidth(int $width) : self
394394
return $this;
395395
}
396396

397-
public function setPadding(int $topBottom, int $leftRight = null) : self
397+
public function setPadding(int $topBottom, ?int $leftRight = null) : self
398398
{
399399
$this->style->setPadding($topBottom, $leftRight);
400400

@@ -452,7 +452,7 @@ public function setTitleSeparator(string $separator) : self
452452
* @param int|string|null $bottom
453453
* @param int|string|null $left
454454
*/
455-
public function setBorder(int $top, $right = null, $bottom = null, $left = null, string $colour = null) : self
455+
public function setBorder(int $top, $right = null, $bottom = null, $left = null, ?string $colour = null) : self
456456
{
457457
$this->style->setBorder($top, $right, $bottom, $left, $colour);
458458

@@ -487,7 +487,7 @@ public function setBorderLeftWidth(int $width) : self
487487
return $this;
488488
}
489489

490-
public function setBorderColour(string $colour, string $fallback = null) : self
490+
public function setBorderColour(string $colour, ?string $fallback = null) : self
491491
{
492492
$this->style->setBorderColour($colour, $fallback);
493493

src/Builder/SplitItemBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function setGutter(int $gutter) : self
144144
return $this;
145145
}
146146

147-
public function enableAutoShortcuts(string $regex = null) : self
147+
public function enableAutoShortcuts(?string $regex = null) : self
148148
{
149149
$this->autoShortcuts = true;
150150

src/CliMenu.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ class CliMenu
9999
public function __construct(
100100
?string $title,
101101
array $items,
102-
Terminal $terminal = null,
103-
MenuStyle $style = null
102+
?Terminal $terminal = null,
103+
?MenuStyle $style = null
104104
) {
105105
$this->title = $title;
106106
$this->items = $items;
@@ -696,7 +696,7 @@ public function getCurrentFrame() : Frame
696696
return $this->currentFrame;
697697
}
698698

699-
public function flash(string $text, MenuStyle $style = null) : Flash
699+
public function flash(string $text, ?MenuStyle $style = null) : Flash
700700
{
701701
$this->guardSingleLine($text);
702702

@@ -707,7 +707,7 @@ public function flash(string $text, MenuStyle $style = null) : Flash
707707
return new Flash($this, $style, $this->terminal, $text);
708708
}
709709

710-
public function confirm(string $text, MenuStyle $style = null) : Confirm
710+
public function confirm(string $text, ?MenuStyle $style = null) : Confirm
711711
{
712712
$this->guardSingleLine($text);
713713

@@ -718,7 +718,7 @@ public function confirm(string $text, MenuStyle $style = null) : Confirm
718718
return new Confirm($this, $style, $this->terminal, $text);
719719
}
720720

721-
public function cancellableConfirm(string $text, MenuStyle $style = null) : CancellableConfirm
721+
public function cancellableConfirm(string $text, ?MenuStyle $style = null) : CancellableConfirm
722722
{
723723
$this->guardSingleLine($text);
724724

@@ -729,7 +729,7 @@ public function cancellableConfirm(string $text, MenuStyle $style = null) : Canc
729729
return new CancellableConfirm($this, $style, $this->terminal, $text);
730730
}
731731

732-
public function askNumber(MenuStyle $style = null) : Number
732+
public function askNumber(?MenuStyle $style = null) : Number
733733
{
734734
$this->assertOpen();
735735

@@ -740,7 +740,7 @@ public function askNumber(MenuStyle $style = null) : Number
740740
return new Number(new InputIO($this, $this->terminal), $style);
741741
}
742742

743-
public function askText(MenuStyle $style = null) : Text
743+
public function askText(?MenuStyle $style = null) : Text
744744
{
745745
$this->assertOpen();
746746

@@ -751,7 +751,7 @@ public function askText(MenuStyle $style = null) : Text
751751
return new Text(new InputIO($this, $this->terminal), $style);
752752
}
753753

754-
public function askPassword(MenuStyle $style = null) : Password
754+
public function askPassword(?MenuStyle $style = null) : Password
755755
{
756756
$this->assertOpen();
757757

src/Dialogue/Dialogue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected function emptyRow() : void
108108
/**
109109
* Write some text at a particular column
110110
*/
111-
protected function write(string $text, int $column = null) : void
111+
protected function write(string $text, ?int $column = null) : void
112112
{
113113
$this->terminal->moveCursorToColumn($column ?: $this->x);
114114
$this->terminal->write($text);

src/MenuStyle.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class MenuStyle
227227
/**
228228
* Initialise style
229229
*/
230-
public function __construct(Terminal $terminal = null)
230+
public function __construct(?Terminal $terminal = null)
231231
{
232232
$this->terminal = $terminal ?: TerminalFactory::fromSystem();
233233

@@ -401,7 +401,7 @@ public function getFg() : string
401401
return $this->fg;
402402
}
403403

404-
public function setFg(string $fg, string $fallback = null) : self
404+
public function setFg(string $fg, ?string $fallback = null) : self
405405
{
406406
$this->fg = ColourUtil::validateColour(
407407
$this->terminal,
@@ -418,7 +418,7 @@ public function getBg() : string
418418
return $this->bg;
419419
}
420420

421-
public function setBg(string $bg, string $fallback = null) : self
421+
public function setBg(string $bg, ?string $fallback = null) : self
422422
{
423423
$this->bg = ColourUtil::validateColour(
424424
$this->terminal,
@@ -522,7 +522,7 @@ public function getPaddingTopBottomRows() : array
522522
return $this->paddingTopBottomRows;
523523
}
524524

525-
public function setPadding(int $topBottom, int $leftRight = null) : self
525+
public function setPadding(int $topBottom, ?int $leftRight = null) : self
526526
{
527527
if ($leftRight === null) {
528528
$leftRight = $topBottom;
@@ -700,7 +700,7 @@ public function setBorder(
700700
$rightWidth = null,
701701
$bottomWidth = null,
702702
$leftWidth = null,
703-
string $colour = null
703+
?string $colour = null
704704
) : self {
705705
if (!is_int($rightWidth)) {
706706
$colour = $rightWidth;
@@ -768,7 +768,7 @@ public function setBorderLeftWidth(int $width) : self
768768
return $this;
769769
}
770770

771-
public function setBorderColour(string $colour, string $fallback = null) : self
771+
public function setBorderColour(string $colour, ?string $fallback = null) : self
772772
{
773773
$this->borderColour = ColourUtil::validateColour(
774774
$this->terminal,

src/Util/ColourUtil.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public static function map256To8(int $colourCode) : string
307307
* Check if $colour exists
308308
* If it's a 256-colours code and $terminal doesn't support it, returns a fallback value
309309
*/
310-
public static function validateColour(Terminal $terminal, string $colour, string $fallback = null) : string
310+
public static function validateColour(Terminal $terminal, string $colour, ?string $fallback = null) : string
311311
{
312312
if (!is_numeric($colour)) {
313313
return self::validateColourName($colour);

0 commit comments

Comments
 (0)