From 9b99712fcef68f47c0ee6d3689fdb7edacc41abf Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 5 May 2024 11:17:33 +0200 Subject: [PATCH] handle further PHP 8.2 deprecations PHP 8.2 deprecates implicit conversion from float to int if it loses precision, hence the explicit conversion. I missed these in 6bcef2fa24e04b96e9f630c8b47fa91bb4ac95f8 --- lib/Vizhash16x16.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Vizhash16x16.php b/lib/Vizhash16x16.php index 2d296af8..5a408655 100644 --- a/lib/Vizhash16x16.php +++ b/lib/Vizhash16x16.php @@ -109,9 +109,9 @@ class Vizhash16x16 for ($i = 0; $i < 7; ++$i) { $action = $this->getInt(); $color = imagecolorallocate($image, $r, $g, $b); - $r = $r0 = ((int) $r0 + $this->getInt() / 25) % 256; - $g = $g0 = ((int) $g0 + $this->getInt() / 25) % 256; - $b = $b0 = ((int) $b0 + $this->getInt() / 25) % 256; + $r = $r0 = (int) ($r0 + $this->getInt() / 25) % 256; + $g = $g0 = (int) ($g0 + $this->getInt() / 25) % 256; + $b = $b0 = (int) ($b0 + $this->getInt() / 25) % 256; $this->drawshape($image, $action, $color); } @@ -148,7 +148,7 @@ class Vizhash16x16 */ private function getX() { - return (int) $this->width * $this->getInt() / 256; + return (int) ($this->width * $this->getInt() / 256); } /** @@ -159,7 +159,7 @@ class Vizhash16x16 */ private function getY() { - return (int) $this->height * $this->getInt() / 256; + return (int) ($this->height * $this->getInt() / 256); } /** @@ -225,8 +225,8 @@ class Vizhash16x16 version_compare(PHP_VERSION, '8.1', '<') ? imagefilledpolygon($image, $points, 4, $color) : imagefilledpolygon($image, $points, $color); break; default: - $start = $this->getInt() * 360 / 256; - $end = $start + $this->getInt() * 180 / 256; + $start = (int) ($this->getInt() * 360 / 256); + $end = (int) ($start + $this->getInt() * 180 / 256); imagefilledarc($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $start, $end, $color, IMG_ARC_PIE); } }