From 493b1fe582a4ddd1ae51c17a1abda06d5fd31158 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Sun, 29 Jun 2025 07:13:57 -0400 Subject: [PATCH] refactor: remove redundant `+1` offset in `NestedSetsBehavior` class in `shiftLeftRightAttribute` calls. --- src/NestedSetsBehavior.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NestedSetsBehavior.php b/src/NestedSetsBehavior.php index fd25857..49fe8a3 100644 --- a/src/NestedSetsBehavior.php +++ b/src/NestedSetsBehavior.php @@ -142,7 +142,7 @@ public function afterDelete(): void $rightValue = $this->getOwner()->getAttribute($this->rightAttribute); if ($this->operation === self::OPERATION_DELETE_WITH_CHILDREN || $this->getOwner()->isLeaf()) { - $this->shiftLeftRightAttribute($rightValue + 1, $leftValue - $rightValue - 1); + $this->shiftLeftRightAttribute($rightValue, $leftValue - $rightValue - 1); } else { $condition = [ 'and', @@ -1276,7 +1276,7 @@ protected function moveNode(int $value, int $depth): void ], ], ); - $this->shiftLeftRightAttribute($rightValue + 1, $leftValue - $rightValue - 1); + $this->shiftLeftRightAttribute($rightValue, $leftValue - $rightValue - 1); } } @@ -1332,7 +1332,7 @@ protected function moveNodeAsRoot(): void ], ], ); - $this->shiftLeftRightAttribute($rightValue + 1, $leftValue - $rightValue - 1); + $this->shiftLeftRightAttribute($rightValue, $leftValue - $rightValue - 1); } /**