Skip to content

Commit 20ddbfc

Browse files
authored
Merge pull request #9 from UseMuffin/updates
Update static analysis tools config
2 parents 74a9d43 + b12b0e1 commit 20ddbfc

File tree

7 files changed

+24
-22
lines changed

7 files changed

+24
-22
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Orderly
22

3-
[![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)
3+
[![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)
44
[![Coverage](https://img.shields.io/codecov/c/github/UseMuffin/Orderly/master?style=flat-square
55
)](https://app.codecov.io/gh/UseMuffin/Orderly)
66
[![Total Downloads](https://img.shields.io/packagist/dt/muffin/orderly.svg?style=flat-square)](https://packagist.org/packages/muffin/orderly)
@@ -12,13 +12,13 @@ Allows setting default order for your tables.
1212

1313
Using [Composer][composer]:
1414

15-
```
15+
```sh
1616
composer require muffin/orderly
1717
```
1818

1919
Then load the plugin using the console command:
2020

21-
```
21+
```sh
2222
bin/cake plugin load Muffin/Orderly
2323
```
2424

@@ -38,7 +38,7 @@ $this->addBehavior('Muffin/Orderly.Orderly');
3838
$this->addBehavior('Muffin/Orderly.Orderly', ['order' => $this->aliasField('field_name')]);
3939
```
4040

41-
Value for `order` key can any valid value that `\Cake\ORM\Query::orderBy()` takes.
41+
Value for `order` key can any valid value that `\Cake\ORM\Query\SelectQuery::orderBy()` takes.
4242
The default order clause will only be applied to the primary query and when no
4343
custom order clause has already been set for the query.
4444

@@ -48,7 +48,7 @@ condition using `callback` option. The order will be applied if callback returns
4848
```php
4949
$this->addBehavior('Muffin/Orderly.Orderly', [
5050
'order' => ['Alias.field_name' => 'DESC'],
51-
'callback' => function (\Cake\ORM\Query $query, \ArrayObject $options, bool $primary) {
51+
'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) {
5252
//return a boolean
5353
}
5454
]);
@@ -61,13 +61,13 @@ on return value of their respective callbacks:
6161
$this->addBehavior('Muffin/Orderly.Orderly', [
6262
[
6363
'order' => ['Alias.field_name' => 'DESC'],
64-
'callback' => function (\Cake\ORM\Query $query, \ArrayObject $options, bool $primary) {
64+
'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) {
6565
//return a boolean
6666
}
6767
],
6868
[
6969
'order' => ['Alias.another_field'],
70-
'callback' => function (\Cake\ORM\Query $query, \ArrayObject $options, bool $primary) {
70+
'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) {
7171
//return a boolean
7272
}
7373
],

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"require-dev": {
3636
"cakephp/cakephp": "^5.0",
37-
"phpunit/phpunit": "^10.1 || ^11.1"
37+
"phpunit/phpunit": "^10.5.58 || ^11.5.3 || ^12.4"
3838
},
3939
"autoload": {
4040
"psr-4": {

phpcs.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Orderly">
3+
<rule ref="CakePHP"/>
4+
5+
<file>src/</file>
6+
<file>tests/</file>
7+
</ruleset>

phpstan.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
parameters:
22
level: 7
3-
checkMissingIterableValueType: false
4-
checkGenericClassInNonGenericObjectType: false
53
treatPhpDocTypesAsCertain: false
64
bootstrapFiles:
75
- tests/bootstrap.php
86
paths:
97
- src
8+
ignoreErrors:
9+
- identifier: missingType.generics

psalm.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515
</projectFiles>
1616

1717
<issueHandlers>
18-
<MissingClosureReturnType errorLevel="info" />
19-
20-
<PropertyNotSetInConstructor errorLevel="info" />
21-
<MissingClosureParamType errorLevel="info" />
22-
23-
<DocblockTypeContradiction errorLevel="info" />
24-
<RedundantConditionGivenDocblockType errorLevel="info" />
18+
<MissingOverrideAttribute errorLevel="info" />
19+
<ClassMustBeFinal errorLevel="info" />
2520
</issueHandlers>
2621
</psalm>

src/Model/Behavior/OrderlyBehavior.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function _normalizeConfig(array $orders): void
6868
$default = [
6969
'order' => array_map(
7070
$this->_table->aliasField(...),
71-
(array)$this->_table->getDisplayField()
71+
(array)$this->_table->getDisplayField(),
7272
),
7373
'callback' => null,
7474
];

tests/TestCase/Model/Behavior/OrderlyBehaviorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testInitialize()
4444
];
4545
$this->assertEquals(
4646
$expected,
47-
$this->Table->behaviors()->Orderly->getConfig()['orders']
47+
$this->Table->behaviors()->Orderly->getConfig()['orders'],
4848
);
4949

5050
$this->Table->removeBehavior('Orderly');
@@ -58,7 +58,7 @@ public function testInitialize()
5858
];
5959
$this->assertEquals(
6060
$expected,
61-
$this->Table->behaviors()->Orderly->getConfig()['orders']
61+
$this->Table->behaviors()->Orderly->getConfig()['orders'],
6262
);
6363

6464
$callback = function () {
@@ -75,7 +75,7 @@ public function testInitialize()
7575
];
7676
$this->assertEquals(
7777
$expected,
78-
$this->Table->behaviors()->Orderly->getConfig()['orders']
78+
$this->Table->behaviors()->Orderly->getConfig()['orders'],
7979
);
8080

8181
$this->Table->removeBehavior('Orderly');
@@ -96,7 +96,7 @@ public function testInitialize()
9696
];
9797
$this->assertEquals(
9898
$expected,
99-
$this->Table->behaviors()->Orderly->getConfig()['orders']
99+
$this->Table->behaviors()->Orderly->getConfig()['orders'],
100100
);
101101
}
102102

0 commit comments

Comments
 (0)