diff --git a/.github/workflows/bc.yml_ b/.github/workflows/bc.yml_ index 5970206c..d2a73479 100644 --- a/.github/workflows/bc.yml_ +++ b/.github/workflows/bc.yml_ @@ -20,4 +20,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.1'] + ['8.4'] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f082ce5..162552b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,7 @@ jobs: strategy: matrix: php: - - 8.3 + - 8.4 oracle: - 18 @@ -46,6 +46,8 @@ jobs: oracle: 21 - php: 8.2 oracle: 21 + - php: 8.3 + oracle: 21 services: oci: diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index d37dffd5..daf22788 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -36,6 +36,7 @@ jobs: - 8.1 - 8.2 - 8.3 + - 8.4 steps: - name: Checkout. diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index d2232faa..f57b2909 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -34,7 +34,7 @@ jobs: - ubuntu-latest php: - - 8.3 + - 8.4 services: oci: diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index 73c9d27f..4f252850 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -19,4 +19,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.3'] + ['8.4'] diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 2f4ca817..47eff664 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -35,9 +35,10 @@ jobs: - ubuntu-latest php: - - '8.1' - - '8.2' - - '8.3' + - 8.1 + - 8.2 + - 8.3 + - 8.4 steps: - name: Checkout. diff --git a/CHANGELOG.md b/CHANGELOG.md index b100f4cb..cb825738 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ - New #301: Add `IndexType` class (@Tigrov) - New #303: Support JSON type (@Tigrov) - Bug #305: Explicitly mark nullable parameters (@vjik) +- Chg #306: Change supported PHP versions to `8.1 - 8.4` (@Tigrov) +- Enh #306: Minor refactoring (@Tigrov) - New #307: Add parameters `$ifExists` and `$cascade` to `CommandInterface::dropTable()` and `DDLQueryBuilderInterface::dropTable()` methods (@vjik) diff --git a/README.md b/README.md index 7fd86da3..188b0d33 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ your Oracle database and perform various database operations as needed. | PHP | Oracle Version | CI-Actions | |---------------|----------------|------------| -| **8.1 - 8.3** | **12c - 21c**|[![build](https://github.com/yiisoft/db-oracle/actions/workflows/build.yml/badge.svg?branch=dev)](https://github.com/yiisoft/db-oracle/actions/workflows/build.yml) [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fdb-oracle%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/db-oracle/master) [![static analysis](https://github.com/yiisoft/db-oracle/actions/workflows/static.yml/badge.svg?branch=dev)](https://github.com/yiisoft/db-oracle/actions/workflows/static.yml) [![type-coverage](https://shepherd.dev/github/yiisoft/db-oracle/coverage.svg)](https://shepherd.dev/github/yiisoft/db-oracle) +| **8.1 - 8.4** | **12c - 21c**|[![build](https://github.com/yiisoft/db-oracle/actions/workflows/build.yml/badge.svg?branch=dev)](https://github.com/yiisoft/db-oracle/actions/workflows/build.yml) [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fdb-oracle%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/db-oracle/master) [![static analysis](https://github.com/yiisoft/db-oracle/actions/workflows/static.yml/badge.svg?branch=dev)](https://github.com/yiisoft/db-oracle/actions/workflows/static.yml) [![type-coverage](https://shepherd.dev/github/yiisoft/db-oracle/coverage.svg)](https://shepherd.dev/github/yiisoft/db-oracle) ## Installation diff --git a/composer.json b/composer.json index 0ebf770a..0d1a01bf 100644 --- a/composer.json +++ b/composer.json @@ -31,20 +31,20 @@ ], "require": { "ext-pdo": "*", - "php": "^8.1", + "php": "8.1 - 8.4", "yiisoft/db": "dev-master" }, "require-dev": { - "maglnet/composer-require-checker": "^4.2", - "phpunit/phpunit": "^10.0", - "rector/rector": "^2.0", - "roave/infection-static-analysis-plugin": "^1.16", - "spatie/phpunit-watcher": "^1.23", - "vimeo/psalm": "^5.25", - "vlucas/phpdotenv": "^5.6", + "maglnet/composer-require-checker": "^4.7.1", + "phpunit/phpunit": "^10.5.45", + "rector/rector": "^2.0.10", + "roave/infection-static-analysis-plugin": "^1.35", + "spatie/phpunit-watcher": "^1.24", + "vimeo/psalm": "^5.26.1 || ^6.8.8", + "vlucas/phpdotenv": "^5.6.1", "yiisoft/aliases": "^2.0", - "yiisoft/cache-file": "^3.1", - "yiisoft/var-dumper": "^1.5" + "yiisoft/cache-file": "^3.2", + "yiisoft/var-dumper": "^1.7" }, "autoload": { "psr-4": { diff --git a/psalm.xml b/psalm.xml index fc577119..6461f99d 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,9 +1,11 @@ $type]; $typeDetails = $matches[6] ?? $matches[2] ?? ''; diff --git a/src/Column/JsonColumn.php b/src/Column/JsonColumn.php index e7797775..b6387a9e 100644 --- a/src/Column/JsonColumn.php +++ b/src/Column/JsonColumn.php @@ -28,7 +28,9 @@ public function phpTypecast(mixed $value): mixed } if (is_resource($value)) { - return json_decode(stream_get_contents($value), true, 512, JSON_THROW_ON_ERROR); + /** @var string */ + $value = stream_get_contents($value); + return json_decode($value, true, 512, JSON_THROW_ON_ERROR); } return $value; diff --git a/src/Command.php b/src/Command.php index 196a6892..8fd58a4e 100644 --- a/src/Command.php +++ b/src/Command.php @@ -21,7 +21,7 @@ */ final class Command extends AbstractPdoCommand { - public function insertWithReturningPks(string $table, array $columns): bool|array + public function insertWithReturningPks(string $table, array $columns): array|false { $tableSchema = $this->db->getSchema()->getTableSchema($table); $returnColumns = $tableSchema?->getPrimaryKey() ?? []; diff --git a/src/Schema.php b/src/Schema.php index 0fa001c1..3b3f9454 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -446,7 +446,9 @@ protected function getTableSequenceName(string $tableName): string|null */ private function loadColumn(array $info): ColumnInterface { - $dbType = strtolower(preg_replace('/\([^)]+\)/', '', $info['data_type'])); + /** @var string $dbType */ + $dbType = preg_replace('/\([^)]+\)/', '', $info['data_type']); + $dbType = strtolower($dbType); match ($dbType) { 'timestamp', diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 1ec58cb1..1c0bfba1 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -228,12 +228,12 @@ public function testCreateView(): void )->execute(); $command->setSql( <<execute(); $command->setSql( <<execute(); $command->createView('{{testCreateView}}', $subquery)->execute(); @@ -640,12 +640,12 @@ public function testQueryScalarWithBlob(): void $this->assertEquals($value, $scalarValue); } - public function testProfiler(string $sql = null): void + public function testProfiler(string|null $sql = null): void { parent::testProfiler('SELECT 123 FROM DUAL'); } - public function testProfilerData(string $sql = null): void + public function testProfilerData(string|null $sql = null): void { parent::testProfilerData('SELECT 123 FROM DUAL'); } diff --git a/tests/QuoterTest.php b/tests/QuoterTest.php index 8f949d8c..5f665e68 100644 --- a/tests/QuoterTest.php +++ b/tests/QuoterTest.php @@ -38,7 +38,7 @@ public function testQuoteColumnName(string $columnName, string $expected): void public function testQuoteSimpleColumnName( string $columnName, string $expectedQuotedColumnName, - string $expectedUnQuotedColumnName = null + string|null $expectedUnQuotedColumnName = null ): void { parent::testQuoteSimpleColumnName($columnName, $expectedQuotedColumnName, $expectedUnQuotedColumnName); }