diff --git a/src/BinPacker.php b/src/BinPacker.php index 7e3b48c..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() ; + return $a->getHeight() < $b->getHeight() ? -1 : ($a->getHeight() === $b->getHeight() ? 0 : 1); }); return $blocks;