From 3dc8f9d06d02dc8281c76b2f973bd750e0b5054d Mon Sep 17 00:00:00 2001 From: Dmitriy Krivopalov Date: Tue, 14 Apr 2026 10:47:05 +0300 Subject: [PATCH] update 20260414 --- README.md | 16 ++++++++++++---- rector.php | 17 +++++++++++++---- src/exception/ConfigurationException.php | 4 ---- src/exception/PrepareException.php | 4 ---- src/internal/filesystem/Action.php | 2 +- tests/stub/TestDriverError.php | 4 ---- tests/workflow/ConfigurationTest.php | 2 +- 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 878b727..bf0c974 100644 --- a/README.md +++ b/README.md @@ -3,18 +3,26 @@ ### Static analysis To run static analysis: -- psalm -- phpstan +- [psalm](https://psalm.dev/) +- [phpstan](https://phpstan.org/) ```shell make check ``` +To fix code style: +- [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) +- [rector](https://getrector.com/) + +```shell +make fix +``` + ### Testing The package is tested with -- [PHPUnit](https://phpunit.de/). -- [Infection](https://github.com/infection/infection). +- [PHPUnit](https://phpunit.de/) +- [Infection](https://github.com/infection/infection) To run tests: ```shell diff --git a/rector.php b/rector.php index e556580..6e66834 100644 --- a/rector.php +++ b/rector.php @@ -6,7 +6,8 @@ declare(strict_types=1); -use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; +use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector; +use Rector\Set\ValueObject\SetList; return Rector\Config\RectorConfig::configure() ->withPaths( @@ -17,9 +18,17 @@ ) ->withParallel() ->withCache('/tmp/var/rector') - ->withPhpSets() - ->withRules( + ->withPhpSets(php83: true) + ->withSets( [ - InlineConstructorDefaultToPropertyRector::class, + SetList::CODE_QUALITY, + SetList::DEAD_CODE, + SetList::PRIVATIZATION, + SetList::TYPE_DECLARATION_DOCBLOCKS, + ] + ) + ->withSkip( + [ + RemoveNonExistingVarAnnotationRector::class, ] ); diff --git a/src/exception/ConfigurationException.php b/src/exception/ConfigurationException.php index 216c549..f0af816 100644 --- a/src/exception/ConfigurationException.php +++ b/src/exception/ConfigurationException.php @@ -6,8 +6,4 @@ final class ConfigurationException extends MigratorException { - public function __construct(string $message) - { - parent::__construct($message); - } } diff --git a/src/exception/PrepareException.php b/src/exception/PrepareException.php index dc563ee..57a2fa8 100644 --- a/src/exception/PrepareException.php +++ b/src/exception/PrepareException.php @@ -6,8 +6,4 @@ final class PrepareException extends MigratorException { - public function __construct(string $message) - { - parent::__construct(message: $message); - } } diff --git a/src/internal/filesystem/Action.php b/src/internal/filesystem/Action.php index a30a908..23368ac 100644 --- a/src/internal/filesystem/Action.php +++ b/src/internal/filesystem/Action.php @@ -64,7 +64,7 @@ public function up(array $listExcluded, Options $options = new Options()): Itera public function down(array $listApplied, Options $options = new Options()): Iterator { $iternum = 0; - foreach ($listApplied as $filename => $_) { + foreach (array_keys($listApplied) as $filename) { if ($options->limit > 0 && $iternum >= $options->limit) { return; } diff --git a/tests/stub/TestDriverError.php b/tests/stub/TestDriverError.php index ff6a826..6a65bab 100644 --- a/tests/stub/TestDriverError.php +++ b/tests/stub/TestDriverError.php @@ -12,10 +12,6 @@ final readonly class TestDriverError implements DriverInterface { - public function __construct() - { - } - #[Override] public function getName(): string { diff --git a/tests/workflow/ConfigurationTest.php b/tests/workflow/ConfigurationTest.php index 609e445..efaa8cb 100644 --- a/tests/workflow/ConfigurationTest.php +++ b/tests/workflow/ConfigurationTest.php @@ -4,13 +4,13 @@ namespace dbschemix\core\tests\workflow; -use dbschemix\core\tests\stub\TestDriverError; use Override; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use dbschemix\core\exception\ConnectionException; use dbschemix\core\exception\ConfigurationException; use dbschemix\core\exception\InitializationException; +use dbschemix\core\tests\stub\TestDriverError; use dbschemix\core\tests\stub\TestDriver; use dbschemix\core\tests\stub\TestStorage; use dbschemix\core\tests\MigratorFactory;