Skip to content

Commit

Permalink
Merge pull request #252 from php-school/fix-php81-depreactions
Browse files Browse the repository at this point in the history
Fix PHP 8.1 deprecations
  • Loading branch information
AydinHassan committed Dec 16, 2021
2 parents 5b4abee + 7536e2a commit 112d36f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/MenuStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ class MenuStyle
/**
* @var int
*/
protected $paddingTopBottom;
protected $paddingTopBottom = 0;

/**
* @var int
*/
protected $paddingLeftRight;
protected $paddingLeftRight = 0;

/**
* @var array
Expand Down Expand Up @@ -116,22 +116,22 @@ class MenuStyle
/**
* @var int
*/
private $borderTopWidth;
private $borderTopWidth = 0;

/**
* @var int
*/
private $borderRightWidth;
private $borderRightWidth = 0;

/**
* @var int
*/
private $borderBottomWidth;
private $borderBottomWidth = 0;

/**
* @var int
*/
private $borderLeftWidth;
private $borderLeftWidth = 0;

/**
* @var string
Expand Down Expand Up @@ -509,7 +509,7 @@ private function generatePaddingTopBottomRows() : void
);
}

$this->paddingTopBottom = $this->paddingTopBottom >= 0 ? $this->paddingTopBottom : 0;
$this->paddingTopBottom = max($this->paddingTopBottom, 0);
$this->paddingTopBottomRows = array_fill(0, $this->paddingTopBottom, $paddingRow);
}

Expand Down Expand Up @@ -664,9 +664,8 @@ private function generateBorderRows() : void
);
}

$this->borderTopWidth = $this->borderTopWidth >= 0 ? $this->borderTopWidth : 0;
$this->borderBottomWidth = $this->borderBottomWidth >= 0 ? $this->borderBottomWidth : 0;

$this->borderTopWidth = max($this->borderTopWidth, 0);
$this->borderBottomWidth = max($this->borderBottomWidth, 0);

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

0 comments on commit 112d36f

Please sign in to comment.