Просмотр исходного кода

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
El RIDO 2 лет назад
Родитель
Сommit
9b99712fce
1 измененных файлов с 7 добавлено и 7 удалено
  1. 7 7
      lib/Vizhash16x16.php

+ 7 - 7
lib/Vizhash16x16.php

@@ -109,9 +109,9 @@ class Vizhash16x16
         for ($i = 0; $i < 7; ++$i) {
         for ($i = 0; $i < 7; ++$i) {
             $action = $this->getInt();
             $action = $this->getInt();
             $color  = imagecolorallocate($image, $r, $g, $b);
             $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);
             $this->drawshape($image, $action, $color);
         }
         }
 
 
@@ -148,7 +148,7 @@ class Vizhash16x16
      */
      */
     private function getX()
     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()
     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);
                 version_compare(PHP_VERSION, '8.1', '<') ? imagefilledpolygon($image, $points, 4, $color) : imagefilledpolygon($image, $points, $color);
                 break;
                 break;
             default:
             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);
                 imagefilledarc($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $start, $end, $color, IMG_ARC_PIE);
         }
         }
     }
     }