Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise PHP version to 8.1 #277

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ jobs:
- 21

include:
- php: 8.0
oracle: 21
- php: 8.1
oracle: 21
- php: 8.2
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
- ubuntu-latest

php:
- 8.0
- 8.1
- 8.2
- 8.3
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
- ubuntu-latest

php:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
Expand Down Expand Up @@ -67,9 +66,4 @@ jobs:
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}

- name: Static analysis.
if: ${{ matrix.php != '8.0' }}
run: vendor/bin/psalm --config=${{ inputs.psalm-config }} --shepherd --stats --output-format=github --php-version=${{ matrix.php }}

- name: Static analysis.
if: ${{ matrix.php == '8.0' }}
run: vendor/bin/psalm --config=psalm4.xml --shepherd --stats --output-format=github --php-version=${{ matrix.php }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
for type casting performance. Related with yiisoft/db#752 (@Tigrov)
- Chg #272: Replace call of `SchemaInterface::getRawTableName()` to `QuoterInterface::getRawTableName()` (@Tigrov)
- Enh #275: Refactor PHP type of `ColumnSchemaInterface` instances (@Tigrov)
- Enh #277: Raise minimum PHP version to `^8.1` with minor refactoring (@Tigrov)

## 1.3.0 March 21, 2024

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ your Oracle database and perform various database operations as needed.

## Support version

| PHP | Oracle Version | CI-Actions |
|-----|----------------|------------|
|**8.0 - 8.2**| **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)
| 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)

## Installation

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
],
"require": {
"ext-pdo": "*",
"php": "^8.0",
"php": "^8.1",
"yiisoft/db": "dev-master"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.2",
"phpunit/phpunit": "^9.6|^10.0",
"phpunit/phpunit": "^10.0",
"rector/rector": "^1.0",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.20",
"vimeo/psalm": "^5.25",
"yiisoft/aliases": "^2.0",
"yiisoft/cache-file": "^3.1",
"yiisoft/var-dumper": "^1.5"
Expand Down
20 changes: 0 additions & 20 deletions psalm4.xml

This file was deleted.

8 changes: 5 additions & 3 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Php73\Rector\String_\SensitiveHereNowDocRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
Expand All @@ -22,11 +23,12 @@

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
LevelSetList::UP_TO_PHP_81,
]);

$rectorConfig->skip([
ClosureToArrowFunctionRector::class,
NullToStrictStringFuncCallArgRector::class,
ReadOnlyPropertyRector::class,
SensitiveHereNowDocRector::class,
]);
};
2 changes: 1 addition & 1 deletion src/DMLQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function insertBatch(string $table, iterable $rows, array $columns = [],
$tableAndColumns = ' INTO ' . $this->quoter->quoteTableName($table);

if (count($columns) > 0) {
$quotedColumnNames = array_map([$this->quoter, 'quoteColumnName'], $columns);
$quotedColumnNames = array_map($this->quoter->quoteColumnName(...), $columns);

$tableAndColumns .= ' (' . implode(', ', $quotedColumnNames) . ')';
}
Expand Down
15 changes: 6 additions & 9 deletions src/DQLQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Yiisoft\Db\QueryBuilder\Condition\InCondition;
use Yiisoft\Db\QueryBuilder\Condition\LikeCondition;

use function array_merge;
use function implode;

/**
Expand Down Expand Up @@ -84,13 +83,11 @@ public function buildWithQueries(array $withs, array &$params): string

protected function defaultExpressionBuilders(): array
{
return array_merge(
parent::defaultExpressionBuilders(),
[
InCondition::class => InConditionBuilder::class,
LikeCondition::class => LikeConditionBuilder::class,
Expression::class => ExpressionBuilder::class,
],
);
return [
...parent::defaultExpressionBuilders(),
InCondition::class => InConditionBuilder::class,
LikeCondition::class => LikeConditionBuilder::class,
Expression::class => ExpressionBuilder::class,
];
}
}
13 changes: 5 additions & 8 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

use function array_change_key_case;
use function array_map;
use function array_merge;
use function array_reverse;
use function implode;
use function is_array;
Expand Down Expand Up @@ -290,7 +289,7 @@ protected function loadTableIndexes(string $tableName): array
])->queryAll();

/** @psalm-var array[] $indexes */
$indexes = array_map('array_change_key_case', $indexes);
$indexes = array_map(array_change_key_case(...), $indexes);
$indexes = DbArrayHelper::index($indexes, null, ['name']);

$result = [];
Expand Down Expand Up @@ -605,7 +604,7 @@ protected function findConstraints(TableSchemaInterface $table): void
}

foreach ($constraints as $index => $constraint) {
$table->foreignKey($index, array_merge([$constraint['tableName']], $constraint['columns']));
$table->foreignKey($index, [$constraint['tableName'], ...$constraint['columns']]);
}
}

Expand Down Expand Up @@ -737,7 +736,7 @@ private function loadTableConstraints(string $tableName, string $returnType): mi
])->queryAll();

/** @psalm-var array[] $constraints */
$constraints = array_map('array_change_key_case', $constraints);
$constraints = array_map(array_change_key_case(...), $constraints);
$constraints = DbArrayHelper::index($constraints, null, ['type', 'name']);

$result = [
Expand Down Expand Up @@ -827,12 +826,10 @@ protected function findViewNames(string $schema = ''): array
* @param string $name The table name.
*
* @return array The cache key.
*
* @psalm-suppress DeprecatedMethod
*/
protected function getCacheKey(string $name): array
{
return array_merge([self::class], $this->generateCacheKey(), [$this->db->getQuoter()->getRawTableName($name)]);
return [self::class, ...$this->generateCacheKey(), $this->db->getQuoter()->getRawTableName($name)];
}

/**
Expand All @@ -844,6 +841,6 @@ protected function getCacheKey(string $name): array
*/
protected function getCacheTag(): string
{
return md5(serialize(array_merge([self::class], $this->generateCacheKey())));
return md5(serialize([self::class, ...$this->generateCacheKey()]));
}
}
10 changes: 4 additions & 6 deletions tests/Provider/ColumnSchemaBuilderProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ public static function types(): array
$types[0][0] = 'integer UNSIGNED DEFAULT NULL NULL';
$types[1][0] = 'integer(10) UNSIGNED';

return array_merge(
$types,
[
['integer UNSIGNED', SchemaInterface::TYPE_INTEGER, null, [['unsigned']]],
],
);
return [
...$types,
['integer UNSIGNED', SchemaInterface::TYPE_INTEGER, null, [['unsigned']]],
];
}

public static function createColumnTypes(): array
Expand Down
Loading