diff --git a/README.md b/README.md
index 2ca672c..e2bdef6 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Orderly
-[](https://github.com/UseMuffin/Orderly/actions/workflows/ci.yml?query=branch%3Amaster)
+[](https://github.com/UseMuffin/Orderly/actions/workflows/ci.yml?query=branch%3Amaster)
[](https://app.codecov.io/gh/UseMuffin/Orderly)
[](https://packagist.org/packages/muffin/orderly)
@@ -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
}
],
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/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
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 @@
-
-
-
-
-
-
-
+
+
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'],
);
}