From 636d2d008b96cc056b9171d60d836a1d3d92fcdb Mon Sep 17 00:00:00 2001 From: jeriba4 Date: Wed, 1 Nov 2023 15:58:19 +0100 Subject: [PATCH] phplot.php: type casts for PHP 8.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As announced in issue comment, I´ve just cast the arguments of the calls used for my use cases to int. Of course, a more profound approach would be to type the respective function parameters or class properties to int or, if anyway needed, nullable int (?int), but that might break compatibility with PHP 7.x. --- src/phplot.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/phplot.php b/src/phplot.php index e5b7465..7f54650 100644 --- a/src/phplot.php +++ b/src/phplot.php @@ -1908,7 +1908,7 @@ protected function ProcessTextGD($draw_it, $font, $angle, $x, $y, $color, $text, $y = $ypos - $r10 * $factor; // Call ImageString or ImageStringUp: - $draw_func($this->img, $font_number, $x, $y, $lines[$i], $color); + $draw_func($this->img, $font_number, (int)$x, (int)$y, $lines[$i], (int)$color); // Step to the next line of text. This is a rotation of (x=0, y=interline_spacing) $xpos += $r01 * $interline_step; @@ -7520,10 +7520,10 @@ protected function DrawLegend() // Draw color boxes: ImageFilledRectangle( $this->img, - $dot_left_x, - $y1, - $dot_right_x, - $y2, + (int) $dot_left_x, + (int) $y1, + (int) $dot_right_x, + (int) $y2, $this->ndx_data_colors[$color_index] ); // Draw a rectangle around the box, if enabled. @@ -8327,13 +8327,13 @@ protected function DrawPieChart() // Draw the slice ImageFilledArc( $this->img, - $xpos, - $ypos + $h, - $pie_width, - $pie_height, - $arc_end_angle, - $arc_start_angle, - $slicecol, + (int) $xpos, + (int) $ypos + $h, + (int) $pie_width, + (int) $pie_height, + (int) $arc_end_angle, + (int) $arc_start_angle, + (int) $slicecol, IMG_ARC_PIE );