Skip to content
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
27 changes: 27 additions & 0 deletions .github/workflows/rector-cs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Rector + PHP CS Fixer

on:
pull_request_target:
paths:
- 'src/**'
- 'tests/**'
- '.github/workflows/rector-cs.yml'
- 'composer.json'
- 'rector.php'
- '.php-cs-fixer.dist.php'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
rector:
uses: yiisoft/actions/.github/workflows/rector-cs.yml@master
secrets:
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
php: '8.1'
28 changes: 0 additions & 28 deletions .github/workflows/rector.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ phpunit.phar
/phpunit.xml
# phpunit cache
.phpunit.result.cache

# PHP CS Fixer
/.php-cs-fixer.cache
/.php-cs-fixer.php
34 changes: 34 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

$finder = (new Finder())->in([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

return (new Config())
->setRiskyAllowed(true)
->setParallelConfig(ParallelConfigFactory::detect())
->setRules([
'@PER-CS3.0' => true,
'no_unused_imports' => true,
'ordered_class_elements' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one']],
'declare_strict_types' => true,
'native_function_invocation' => true,
'native_constant_invocation' => true,
'fully_qualified_strict_types' => [
'import_symbols' => true
],
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
])
->setFinder($finder);
85 changes: 0 additions & 85 deletions .styleci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1.1.1 under development

- no changes in this release.
- Enh #99: Explicitly import classes and functions in "use" section (@mspirkov)

## 1.1.0 December 17, 2025

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"yiisoft/log": "^2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.92.5",
"maglnet/composer-require-checker": "^4.7.1",
"phpunit/phpunit": "^10.5.60",
"rector/rector": "^2.2.14",
Expand Down
6 changes: 3 additions & 3 deletions src/DbCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use function strpbrk;
use function time;
use function unserialize;
use function is_resource;

/**
* DbCache stores cache data in a database table.
Expand All @@ -48,9 +49,8 @@ final class DbCache implements CacheInterface
public function __construct(
private ConnectionInterface $db,
private string $table = '{{%yii_cache}}',
public int $gcProbability = 100
) {
}
public int $gcProbability = 100,
) {}

/**
* Gets an instance of a database connection.
Expand Down
4 changes: 1 addition & 3 deletions src/DbSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
*/
final class DbSchemaManager
{
public function __construct(private readonly ConnectionInterface $db)
{
}
public function __construct(private readonly ConnectionInterface $db) {}

/**
* Ensures that the cache table exists in the database.
Expand Down
5 changes: 2 additions & 3 deletions src/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

namespace Yiisoft\Cache\Db;

use Psr\SimpleCache\InvalidArgumentException as PsrInvalidArgumentException;
use RuntimeException;

final class InvalidArgumentException extends RuntimeException implements \Psr\SimpleCache\InvalidArgumentException
{
}
final class InvalidArgumentException extends RuntimeException implements PsrInvalidArgumentException {}
4 changes: 2 additions & 2 deletions tests/Common/AbstractDbCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function testDeleteMultiple(): void
$this->assertSameExceptObject($data, $this->dbCache->getMultiple($keys));

$this->dbCache->deleteMultiple($keys);
$emptyData = array_map(static fn () => null, $data);
$emptyData = array_map(static fn() => null, $data);

$this->assertSameExceptObject($emptyData, $this->dbCache->getMultiple($keys));
}
Expand Down Expand Up @@ -228,7 +228,7 @@ public static function iterableProvider(): array
],
'IteratorAggregate' => [
['a' => 1, 'b' => 2,],
new class () implements IteratorAggregate {
new class implements IteratorAggregate {
public function getIterator(): ArrayIterator
{
return new ArrayIterator(['a' => 1, 'b' => 2,]);
Expand Down
2 changes: 2 additions & 0 deletions tests/Common/AbstractSQLDumpFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Constant\ColumnType;

use function dirname;

/**
* @group Mssql
*
Expand Down
2 changes: 1 addition & 1 deletion tests/Common/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
{
protected ConnectionInterface $db;
protected DbCache $dbCache;
protected Logger|null $logger = null;
protected ?Logger $logger = null;
protected string $table = '{{%yii_cache}}';
protected DbSchemaManager $dbSchemaManager;

Expand Down
2 changes: 1 addition & 1 deletion tests/Support/OracleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function createConnection(): ConnectionInterface
$pdoDriver = new Driver(
new Dsn('oci', 'localhost', 'XE', '1521', ['charset' => 'AL32UTF8']),
'system',
'root'
'root',
);
$pdoDriver->attributes([PDO::ATTR_STRINGIFY_FETCHES => true]);

Expand Down