diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6153d71..26d00f0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,15 +10,15 @@ on:
jobs:
testsuite:
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
- php-version: ['7.2', '7.4', '8.0']
+ php-version: ['7.4', '8.0', '8.3']
db-type: ['mysql', 'pgsql']
prefer-lowest: ['']
include:
- - php-version: '7.2'
+ - php-version: '7.4'
db-type: 'sqlite'
prefer-lowest: 'prefer-lowest'
@@ -31,7 +31,7 @@ jobs:
POSTGRES_PASSWORD: postgres
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Setup Service
if: matrix.db-type == 'mysql'
@@ -73,7 +73,7 @@ jobs:
cs-stan:
name: Coding Standard & Static Analysis
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
@@ -84,7 +84,7 @@ jobs:
php-version: '7.4'
extensions: mbstring, intl
coverage: none
- tools: psalm:4.7, phpstan:0.12
+ tools: psalm:4, phpstan:1
- name: Composer Install
run: composer require cakephp/cakephp-codesniffer:^4.2
diff --git a/composer.json b/composer.json
index 75b78e6..1bee8e4 100644
--- a/composer.json
+++ b/composer.json
@@ -39,12 +39,12 @@
"irc": "irc://irc.freenode.org/muffin"
},
"require": {
- "cakephp/orm": "^4.2"
+ "cakephp/orm": "^4.5"
},
"require-dev": {
- "cakephp/cakephp": "^4.2",
- "cakephp/cakephp-codesniffer": "^4.0",
- "phpunit/phpunit": "^8.5 || ^9.3"
+ "cakephp/cakephp": "^4.5",
+ "cakephp/cakephp-codesniffer": "^4.2",
+ "phpunit/phpunit": "^9.3"
},
"autoload": {
"psr-4": {
@@ -58,5 +58,10 @@
"SomeVendor\\SomePlugin\\": "tests/test_app/plugins/SomeVendor/SomePlugin/src",
"TestPlugin\\": "tests/test_app/plugins/TestPlugin/src"
}
+ },
+ "config": {
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ }
}
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 33055d7..f92600e 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -11,16 +11,9 @@
-
-
-
-
-
-
-
-
+
+
+
diff --git a/psalm.xml b/psalm.xml
index 74ddb1f..edd7691 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -1,6 +1,5 @@
$entities the entities that will get the
* data merged in
* @param array $data list of arrays to be merged into the entities
* @param array $options List of options.
diff --git a/src/Datasource/Query.php b/src/Datasource/Query.php
index d8a8814..0417431 100644
--- a/src/Datasource/Query.php
+++ b/src/Datasource/Query.php
@@ -176,7 +176,7 @@ public function clause(string $name)
*/
public function setEndpoint(Endpoint $endpoint)
{
- $this->repository($endpoint);
+ $this->setRepository($endpoint);
return $this;
}
@@ -262,7 +262,7 @@ public function firstOrFail()
*
* @param string $field The field to alias.
* @param string|null $alias Not being used
- * @return array The field prefixed with the endpoint alias.
+ * @return array The field prefixed with the endpoint alias.
*/
public function aliasField(string $field, ?string $alias = null): array
{
@@ -396,9 +396,9 @@ public function set($fields = null)
/**
* @inheritDoc
*/
- public function offset($num)
+ public function offset($offset)
{
- $this->_parts['offset'] = $num;
+ $this->_parts['offset'] = $offset;
return $this;
}
diff --git a/src/Datasource/ResultSet.php b/src/Datasource/ResultSet.php
index 124cf1b..5978fe7 100644
--- a/src/Datasource/ResultSet.php
+++ b/src/Datasource/ResultSet.php
@@ -6,6 +6,10 @@
use Cake\Collection\CollectionTrait;
use Cake\Datasource\ResultSetInterface;
+/**
+ * @template T of \Cake\Datasource\EntityInterface|array
+ * @implements \Cake\Datasource\ResultSetInterface
+ */
class ResultSet implements ResultSetInterface
{
use CollectionTrait;
@@ -20,7 +24,8 @@ class ResultSet implements ResultSetInterface
/**
* Last record fetched from the statement
*
- * @var array
+ * @var \Cake\Datasource\EntityInterface|array
+ * @psalm-var T
*/
protected $_current;
@@ -55,8 +60,10 @@ public function __construct(array $resources, ?int $total = null)
*
* Part of Iterator interface.
*
- * @return array|object
+ * @return \Cake\Datasource\EntityInterface|array
+ * @psalm-return T
*/
+ #[\ReturnTypeWillChange]
public function current()
{
return $this->_current;
@@ -67,7 +74,6 @@ public function current()
*
* Part of Iterator interface.
*
- * @throws \Cake\Database\Exception
* @return void
*/
public function rewind()
diff --git a/src/Datasource/Schema.php b/src/Datasource/Schema.php
index 062f928..310d1b3 100644
--- a/src/Datasource/Schema.php
+++ b/src/Datasource/Schema.php
@@ -189,7 +189,7 @@ public function columns(): array
* Get column data in the endpoint.
*
* @param string $name The column name.
- * @return array|null Column data or null.
+ * @return array|null Column data or null.
*/
public function getColumn(string $name): ?array
{
@@ -289,7 +289,7 @@ public function baseColumnType(string $column): ?string
* Returns an array where the keys are the column names in the schema
* and the values the schema type they have.
*
- * @return array
+ * @return array
*/
public function typeMap(): array
{
@@ -316,7 +316,7 @@ public function isNullable(string $name): bool
/**
* Get a hash of columns and their default values.
*
- * @return array
+ * @return array
*/
public function defaultValues(): array
{
@@ -357,7 +357,7 @@ public function getPrimaryKey(): array
/**
* Set the schema options for an endpoint
*
- * @param array $options Array of options to set
+ * @param array $options Array of options to set
* @return $this
*/
public function setOptions(array $options)
@@ -370,7 +370,7 @@ public function setOptions(array $options)
/**
* Get the schema options
*
- * @return array
+ * @return array
*/
public function getOptions(): array
{
diff --git a/src/Model/Endpoint.php b/src/Model/Endpoint.php
index 110d05c..34c36f6 100644
--- a/src/Model/Endpoint.php
+++ b/src/Model/Endpoint.php
@@ -1182,7 +1182,7 @@ public function patchEntity(EntityInterface $entity, array $data, array $options
* $article = $this->Articles->patchEntities($articles, $this->request->data());
* ```
*
- * @param array|\Traversable $entities the entities that will get the
+ * @param iterable<\Cake\Datasource\EntityInterface> $entities the entities that will get the
* data merged in
* @param array $data list of arrays to be merged into the entities
* @param array $options A list of options for the objects hydration.
@@ -1218,7 +1218,7 @@ public function patchEntities(iterable $entities, array $data, array $options =
* - Model.beforeRules => beforeRules
* - Model.afterRules => afterRules
*
- * @return array
+ * @return array
*/
public function implementedEvents(): array
{
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 76891ea..a6bb912 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -103,3 +103,7 @@
'file' => 'error',
],
]);
+
+Configure::write('Error.ignoredDeprecationPaths', [
+ 'ests/TestCase/BootstrapTest.php',
+]);