From d7fd99e4ab4a6f8d76f2db9681bd7423ac6699eb Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Fri, 29 Sep 2023 15:54:13 +0200 Subject: [PATCH] Fix deprecation warnings --- src/Geometry/Polygon.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Geometry/Polygon.php b/src/Geometry/Polygon.php index 50cf3cb0d..e7bee7bc5 100644 --- a/src/Geometry/Polygon.php +++ b/src/Geometry/Polygon.php @@ -300,7 +300,9 @@ public function align(string $position): self } foreach ($this->points as $point) { - $point->setX($point->getX() - $diff); + $point->setX( + intval($point->getX() - $diff) + ); } return $this; @@ -331,7 +333,9 @@ public function valign(string $position): self } foreach ($this->points as $point) { - $point->setY($point->getY() - $diff); + $point->setY( + intval($point->getY() - $diff), + ); } return $this; @@ -350,16 +354,24 @@ public function rotate(float $angle): self foreach ($this->points as $point) { // translate point to pivot - $point->setX($point->getX() - $this->getPivot()->getX()); - $point->setY($point->getY() - $this->getPivot()->getY()); + $point->setX( + intval($point->getX() - $this->getPivot()->getX()), + ); + $point->setY( + intval($point->getY() - $this->getPivot()->getY()), + ); // rotate point $x = $point->getX() * $cos - $point->getY() * $sin; $y = $point->getX() * $sin + $point->getY() * $cos; // translate point back - $point->setX($x + $this->getPivot()->getX()); - $point->setY($y + $this->getPivot()->getY()); + $point->setX( + intval($x + $this->getPivot()->getX()), + ); + $point->setY( + intval($y + $this->getPivot()->getY()), + ); } return $this;