From 6a5db934df3ba792e4496ddd264bac9f20a3d583 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 9 Nov 2025 21:49:09 +0530 Subject: [PATCH 1/6] Fix deprecation warning on CakePHP 5.3 Closes #49 --- src/Model/Behavior/SequenceBehavior.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Behavior/SequenceBehavior.php b/src/Model/Behavior/SequenceBehavior.php index 7053602..dacc5aa 100644 --- a/src/Model/Behavior/SequenceBehavior.php +++ b/src/Model/Behavior/SequenceBehavior.php @@ -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); From ef9bac582927f14bd64b6a5853b37f8979d6b3ca Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 9 Nov 2025 21:52:13 +0530 Subject: [PATCH 2/6] Update phpunit version constraints --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 86e3a25..e827486 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ }, "require-dev": { "cakephp/cakephp": "^5.0", - "phpunit/phpunit": "^10.1" + "phpunit/phpunit": "^10.5.5 || ^11.1.3 || ^12.0.9" }, "autoload": { "psr-4": { From 199264fa3676cb2c70d3fdc479f76f421066e666 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 9 Nov 2025 21:54:51 +0530 Subject: [PATCH 3/6] Fix CS error --- src/Model/Behavior/SequenceBehavior.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Model/Behavior/SequenceBehavior.php b/src/Model/Behavior/SequenceBehavior.php index dacc5aa..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); From 542cd8b4b3ad79f7196a377a16e72649577d2823 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 9 Nov 2025 22:06:24 +0530 Subject: [PATCH 4/6] Update phpunit version constraints --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e827486..aacd714 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ }, "require-dev": { "cakephp/cakephp": "^5.0", - "phpunit/phpunit": "^10.5.5 || ^11.1.3 || ^12.0.9" + "phpunit/phpunit": "^11.5.3 || ^12.1.3" }, "autoload": { "psr-4": { From 5c7f23cb16ed2fda5cf92bbaf2810574f80ea3f0 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 9 Nov 2025 22:07:41 +0530 Subject: [PATCH 5/6] Fix CS error --- tests/TestCase/Model/Behavior/SequenceBehaviorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From aadca89724f3501df8242b38262493113b7eaea7 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 9 Nov 2025 22:11:19 +0530 Subject: [PATCH 6/6] Cleanup psalm usage --- psalm.xml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 psalm.xml diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index a383e3f..0000000 --- a/psalm.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - -