From 7536e2a8a82e275da0fdcb21022b6d13c2050e75 Mon Sep 17 00:00:00 2001 From: Aydin Hassan Date: Thu, 16 Dec 2021 09:02:22 +0000 Subject: [PATCH] Fix PHP 8.1 deprecations --- src/MenuStyle.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/MenuStyle.php b/src/MenuStyle.php index 29ce72c..3d2d00b 100644 --- a/src/MenuStyle.php +++ b/src/MenuStyle.php @@ -61,12 +61,12 @@ class MenuStyle /** * @var int */ - protected $paddingTopBottom; + protected $paddingTopBottom = 0; /** * @var int */ - protected $paddingLeftRight; + protected $paddingLeftRight = 0; /** * @var array @@ -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 @@ -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); } @@ -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);