diff --git a/composer.json b/composer.json index 86e3a25..aacd714 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ }, "require-dev": { "cakephp/cakephp": "^5.0", - "phpunit/phpunit": "^10.1" + "phpunit/phpunit": "^11.5.3 || ^12.1.3" }, "autoload": { "psr-4": { diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index a383e3f..0000000 --- a/psalm.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/Model/Behavior/SequenceBehavior.php b/src/Model/Behavior/SequenceBehavior.php index 7053602..11970ac 100644 --- a/src/Model/Behavior/SequenceBehavior.php +++ b/src/Model/Behavior/SequenceBehavior.php @@ -149,7 +149,7 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array $this->_sync( [$orderField => $this->_getUpdateExpression('+')], [$orderField . ' >=' => $newOrder], - $newScope + $newScope, ); } @@ -176,7 +176,7 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array $this->_sync( [$orderField => $this->_getUpdateExpression('-')], [$orderField . ' >' => $oldOrder], - $oldScope + $oldScope, ); // Order not specified @@ -184,7 +184,7 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array // Insert at end of new scope $entity->set( $orderField, - $this->_getHighestOrder($newScope) + 1 + $this->_getHighestOrder($newScope) + 1, ); // Order specified @@ -193,7 +193,7 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array $this->_sync( [$orderField => $this->_getUpdateExpression('+')], [$orderField . ' >=' => $newOrder], - $newScope + $newScope, ); } // Same scope @@ -207,7 +207,7 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array $orderField . ' >=' => $newOrder, $orderField . ' <' => $oldOrder, ], - $newScope + $newScope, ); // Moving down @@ -219,7 +219,7 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array $orderField . ' >' => $oldOrder, $orderField . ' <=' => $newOrder, ], - $newScope + $newScope, ); } } @@ -262,7 +262,7 @@ public function afterDelete(EventInterface $event, EntityInterface $entity): voi $this->_sync( [$orderField => $this->_getUpdateExpression('-')], [$orderField . ' >' => $order], - $scope + $scope, ); $this->_oldValues = null; @@ -352,7 +352,7 @@ function ($connection) use ($table, $entity, $config, $scope, $direction) { $entity->set($orderField, $newOrder); return $table->save($entity, ['atomic' => false, 'checkRules' => false]); - } + }, ); $table->addBehavior('ADmad/Sequence.Sequence', $config); @@ -406,7 +406,7 @@ function ($connection) use ($table, $records) { $r = $table->save( $record, - ['atomic' => false, 'checkRules' => false] + ['atomic' => false, 'checkRules' => false], ); if ($r === false) { return false; @@ -414,7 +414,7 @@ function ($connection) use ($table, $records) { } return true; - } + }, ); $table->addBehavior('ADmad/Sequence.Sequence', $config); @@ -554,7 +554,7 @@ protected function _getUpdateExpression(string $direction = '+'): QueryExpressio { $field = $this->_config['sequenceField']; - return $this->_table->selectQuery()->newExpr() + return $this->_table->selectQuery()->expr() ->add(new IdentifierExpression($field)) ->add('1') ->setConjunction($direction); diff --git a/tests/TestCase/Model/Behavior/SequenceBehaviorTest.php b/tests/TestCase/Model/Behavior/SequenceBehaviorTest.php index 9a2f63a..5fef156 100644 --- a/tests/TestCase/Model/Behavior/SequenceBehaviorTest.php +++ b/tests/TestCase/Model/Behavior/SequenceBehaviorTest.php @@ -267,7 +267,7 @@ public function testSetOrder() ['id' => 1], ['id' => 5], ], - ['accessibleFields' => ['id' => true]] + ['accessibleFields' => ['id' => true]], ); foreach ($entities as &$entity) { $entity->setNew(false);