Skip to content

Commit 112d36f

Browse files
authored
Merge pull request #252 from php-school/fix-php81-depreactions
Fix PHP 8.1 deprecations
2 parents 5b4abee + 7536e2a commit 112d36f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/MenuStyle.php

+9-10
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ class MenuStyle
6161
/**
6262
* @var int
6363
*/
64-
protected $paddingTopBottom;
64+
protected $paddingTopBottom = 0;
6565

6666
/**
6767
* @var int
6868
*/
69-
protected $paddingLeftRight;
69+
protected $paddingLeftRight = 0;
7070

7171
/**
7272
* @var array
@@ -116,22 +116,22 @@ class MenuStyle
116116
/**
117117
* @var int
118118
*/
119-
private $borderTopWidth;
119+
private $borderTopWidth = 0;
120120

121121
/**
122122
* @var int
123123
*/
124-
private $borderRightWidth;
124+
private $borderRightWidth = 0;
125125

126126
/**
127127
* @var int
128128
*/
129-
private $borderBottomWidth;
129+
private $borderBottomWidth = 0;
130130

131131
/**
132132
* @var int
133133
*/
134-
private $borderLeftWidth;
134+
private $borderLeftWidth = 0;
135135

136136
/**
137137
* @var string
@@ -509,7 +509,7 @@ private function generatePaddingTopBottomRows() : void
509509
);
510510
}
511511

512-
$this->paddingTopBottom = $this->paddingTopBottom >= 0 ? $this->paddingTopBottom : 0;
512+
$this->paddingTopBottom = max($this->paddingTopBottom, 0);
513513
$this->paddingTopBottomRows = array_fill(0, $this->paddingTopBottom, $paddingRow);
514514
}
515515

@@ -664,9 +664,8 @@ private function generateBorderRows() : void
664664
);
665665
}
666666

667-
$this->borderTopWidth = $this->borderTopWidth >= 0 ? $this->borderTopWidth : 0;
668-
$this->borderBottomWidth = $this->borderBottomWidth >= 0 ? $this->borderBottomWidth : 0;
669-
667+
$this->borderTopWidth = max($this->borderTopWidth, 0);
668+
$this->borderBottomWidth = max($this->borderBottomWidth, 0);
670669

671670
$this->borderTopRows = array_fill(0, $this->borderTopWidth, $borderRow);
672671
$this->borderBottomRows = array_fill(0, $this->borderBottomWidth, $borderRow);

0 commit comments

Comments
 (0)