From 6e57d8d1e0c165925f4585be8201c51a26cf53c4 Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 6 Jan 2026 13:46:35 +0530 Subject: [PATCH 1/5] Update static analysis tools config --- composer.json | 2 +- phpstan.neon | 4 ++-- psalm.xml | 9 ++------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 437e6d2..f1743d9 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ }, "require-dev": { "cakephp/cakephp": "^5.0", - "phpunit/phpunit": "^10.1 || ^11.1" + "phpunit/phpunit": "^10.5.58 || ^11.5.3 || ^12.4" }, "autoload": { "psr-4": { diff --git a/phpstan.neon b/phpstan.neon index 34cba21..4ee867a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,9 +1,9 @@ parameters: level: 7 - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false treatPhpDocTypesAsCertain: false bootstrapFiles: - tests/bootstrap.php paths: - src + ignoreErrors: + - identifier: missingType.generics diff --git a/psalm.xml b/psalm.xml index ec6de6b..442fe0f 100644 --- a/psalm.xml +++ b/psalm.xml @@ -15,12 +15,7 @@ - - - - - - - + + From a5c2c1c3a89ce4af6efb63bb78952253aedc47be Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 6 Jan 2026 13:49:52 +0530 Subject: [PATCH 2/5] Add phpcs config --- phpcs.xml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 phpcs.xml diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..e39be6f --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,7 @@ + + + + + src/ + tests/ + \ No newline at end of file From bda3d878f83efd8848939e19c4959ee414f598af Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 6 Jan 2026 13:52:30 +0530 Subject: [PATCH 3/5] Update badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ca672c..e5de7e4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Orderly -[![Build Status](https://img.shields.io/github/actions/workflow/status/UseMuffin/Orderly/ci.yml?style=flat-square&branch=master)](https://github.com/UseMuffin/Orderly/actions/workflows/ci.yml?query=branch%3Amaster) +[![Build Status](https://img.shields.io/github/actions/workflow/status/UseMuffin/Orderly/ci.yml?branch=master&style=flat-square)](https://github.com/UseMuffin/Orderly/actions/workflows/ci.yml?query=branch%3Amaster) [![Coverage](https://img.shields.io/codecov/c/github/UseMuffin/Orderly/master?style=flat-square )](https://app.codecov.io/gh/UseMuffin/Orderly) [![Total Downloads](https://img.shields.io/packagist/dt/muffin/orderly.svg?style=flat-square)](https://packagist.org/packages/muffin/orderly) From e8a29862dd5f37488aebfb1f39f8ef3e4c332142 Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 6 Jan 2026 13:54:50 +0530 Subject: [PATCH 4/5] Update readme --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e5de7e4..e2bdef6 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,13 @@ Allows setting default order for your tables. Using [Composer][composer]: -``` +```sh composer require muffin/orderly ``` Then load the plugin using the console command: -``` +```sh bin/cake plugin load Muffin/Orderly ``` @@ -38,7 +38,7 @@ $this->addBehavior('Muffin/Orderly.Orderly'); $this->addBehavior('Muffin/Orderly.Orderly', ['order' => $this->aliasField('field_name')]); ``` -Value for `order` key can any valid value that `\Cake\ORM\Query::orderBy()` takes. +Value for `order` key can any valid value that `\Cake\ORM\Query\SelectQuery::orderBy()` takes. The default order clause will only be applied to the primary query and when no custom order clause has already been set for the query. @@ -48,7 +48,7 @@ condition using `callback` option. The order will be applied if callback returns ```php $this->addBehavior('Muffin/Orderly.Orderly', [ 'order' => ['Alias.field_name' => 'DESC'], - 'callback' => function (\Cake\ORM\Query $query, \ArrayObject $options, bool $primary) { + 'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) { //return a boolean } ]); @@ -61,13 +61,13 @@ on return value of their respective callbacks: $this->addBehavior('Muffin/Orderly.Orderly', [ [ 'order' => ['Alias.field_name' => 'DESC'], - 'callback' => function (\Cake\ORM\Query $query, \ArrayObject $options, bool $primary) { + 'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) { //return a boolean } ], [ 'order' => ['Alias.another_field'], - 'callback' => function (\Cake\ORM\Query $query, \ArrayObject $options, bool $primary) { + 'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) { //return a boolean } ], From b12b0e1812b87f83bce92f55dbed27714d6683fa Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 6 Jan 2026 14:07:50 +0530 Subject: [PATCH 5/5] Fix CS errors --- src/Model/Behavior/OrderlyBehavior.php | 2 +- tests/TestCase/Model/Behavior/OrderlyBehaviorTest.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Model/Behavior/OrderlyBehavior.php b/src/Model/Behavior/OrderlyBehavior.php index c43aa6e..cdff8e7 100644 --- a/src/Model/Behavior/OrderlyBehavior.php +++ b/src/Model/Behavior/OrderlyBehavior.php @@ -68,7 +68,7 @@ protected function _normalizeConfig(array $orders): void $default = [ 'order' => array_map( $this->_table->aliasField(...), - (array)$this->_table->getDisplayField() + (array)$this->_table->getDisplayField(), ), 'callback' => null, ]; diff --git a/tests/TestCase/Model/Behavior/OrderlyBehaviorTest.php b/tests/TestCase/Model/Behavior/OrderlyBehaviorTest.php index 5e3f8e5..0f27e48 100644 --- a/tests/TestCase/Model/Behavior/OrderlyBehaviorTest.php +++ b/tests/TestCase/Model/Behavior/OrderlyBehaviorTest.php @@ -44,7 +44,7 @@ public function testInitialize() ]; $this->assertEquals( $expected, - $this->Table->behaviors()->Orderly->getConfig()['orders'] + $this->Table->behaviors()->Orderly->getConfig()['orders'], ); $this->Table->removeBehavior('Orderly'); @@ -58,7 +58,7 @@ public function testInitialize() ]; $this->assertEquals( $expected, - $this->Table->behaviors()->Orderly->getConfig()['orders'] + $this->Table->behaviors()->Orderly->getConfig()['orders'], ); $callback = function () { @@ -75,7 +75,7 @@ public function testInitialize() ]; $this->assertEquals( $expected, - $this->Table->behaviors()->Orderly->getConfig()['orders'] + $this->Table->behaviors()->Orderly->getConfig()['orders'], ); $this->Table->removeBehavior('Orderly'); @@ -96,7 +96,7 @@ public function testInitialize() ]; $this->assertEquals( $expected, - $this->Table->behaviors()->Orderly->getConfig()['orders'] + $this->Table->behaviors()->Orderly->getConfig()['orders'], ); }