From 14ae3bf1f2889484f2fb2ce89b9d49edc7608d87 Mon Sep 17 00:00:00 2001 From: 7audio <7audio@users.noreply.github.com> Date: Thu, 22 Dec 2022 12:48:38 +0700 Subject: [PATCH 1/2] Fix deprecation warnings in BinPacker Use int return values in comparison function to fix deprecation warnings (appearing in PHP 8.1.8). --- src/BinPacker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BinPacker.php b/src/BinPacker.php index 7e3b48c..d409f13 100644 --- a/src/BinPacker.php +++ b/src/BinPacker.php @@ -144,7 +144,7 @@ public function growDown(Node $node, $w, $h) private function sort($blocks) { usort($blocks, function (Block $a, Block $b) { - return $a->getHeight() < $b->getHeight() ; + return $a->getHeight() < $b->getHeight() -1 : ($a->getHeight() === $b->getHeight() ? 0 : 1); }); return $blocks; From a99dae81ee2d10025643ed425f5d804f7b657014 Mon Sep 17 00:00:00 2001 From: 7audio <7audio@users.noreply.github.com> Date: Fri, 23 Dec 2022 12:30:23 +0700 Subject: [PATCH 2/2] Update BinPacker.php --- src/BinPacker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BinPacker.php b/src/BinPacker.php index d409f13..835c092 100644 --- a/src/BinPacker.php +++ b/src/BinPacker.php @@ -144,7 +144,7 @@ public function growDown(Node $node, $w, $h) private function sort($blocks) { usort($blocks, function (Block $a, Block $b) { - return $a->getHeight() < $b->getHeight() -1 : ($a->getHeight() === $b->getHeight() ? 0 : 1); + return $a->getHeight() < $b->getHeight() ? -1 : ($a->getHeight() === $b->getHeight() ? 0 : 1); }); return $blocks;