From b6c877b3b8f18659289ffb937c0638911b92c52b Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 13:40:40 +0500 Subject: [PATCH 01/24] Update docs [skip ci] --- README.md | 34 +++------------------ docs/{ => guide}/en/README.md | 0 docs/{ => guide}/en/console-commands.md | 0 docs/{ => guide}/en/installation.md | 0 docs/{ => guide}/en/reading-schema.md | 0 docs/{ => guide}/es/README.md | 0 docs/{ => guide}/es/console-commands.md | 0 docs/{ => guide}/es/installation.md | 0 docs/{ => guide}/es/reading-schema.md | 0 docs/{ => guide}/ru/README.md | 0 docs/{ => guide}/ru/console-commands.md | 0 docs/{ => guide}/ru/installation.md | 0 docs/{ => guide}/ru/reading-schema.md | 0 docs/internals.md | 40 +++++++++++++++++++++++++ 14 files changed, 44 insertions(+), 30 deletions(-) rename docs/{ => guide}/en/README.md (100%) rename docs/{ => guide}/en/console-commands.md (100%) rename docs/{ => guide}/en/installation.md (100%) rename docs/{ => guide}/en/reading-schema.md (100%) rename docs/{ => guide}/es/README.md (100%) rename docs/{ => guide}/es/console-commands.md (100%) rename docs/{ => guide}/es/installation.md (100%) rename docs/{ => guide}/es/reading-schema.md (100%) rename docs/{ => guide}/ru/README.md (100%) rename docs/{ => guide}/ru/console-commands.md (100%) rename docs/{ => guide}/ru/installation.md (100%) rename docs/{ => guide}/ru/reading-schema.md (100%) create mode 100644 docs/internals.md diff --git a/README.md b/README.md index cdc0a6ea..319c6ee9 100644 --- a/README.md +++ b/README.md @@ -23,36 +23,10 @@ Read more in the [official documentation](https://cycle-orm.dev/docs/readme/2.x) ## Documentation -- [English](docs/en/README.md) -- [Russian](docs/ru/README.md) -- [Spanish](docs/es/README.md) - -## Testing - -### Unit testing - -The package is tested with [PHPUnit](https://phpunit.de/). To run tests: - -```shell -./vendor/bin/phpunit -``` - -### Mutation testing - -The package tests are checked with [Infection](https://infection.github.io/) mutation framework with -[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it: - -```shell -./vendor/bin/roave-infection-static-analysis-plugin -``` - -### Static analysis - -The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis: - -```shell -./vendor/bin/psalm -``` +- [English](docs/en/guide) +- [Russian](docs/ru/guide) +- [Spanish](docs/es/guide) +- [Internals](docs/internals.md) ## License diff --git a/docs/en/README.md b/docs/guide/en/README.md similarity index 100% rename from docs/en/README.md rename to docs/guide/en/README.md diff --git a/docs/en/console-commands.md b/docs/guide/en/console-commands.md similarity index 100% rename from docs/en/console-commands.md rename to docs/guide/en/console-commands.md diff --git a/docs/en/installation.md b/docs/guide/en/installation.md similarity index 100% rename from docs/en/installation.md rename to docs/guide/en/installation.md diff --git a/docs/en/reading-schema.md b/docs/guide/en/reading-schema.md similarity index 100% rename from docs/en/reading-schema.md rename to docs/guide/en/reading-schema.md diff --git a/docs/es/README.md b/docs/guide/es/README.md similarity index 100% rename from docs/es/README.md rename to docs/guide/es/README.md diff --git a/docs/es/console-commands.md b/docs/guide/es/console-commands.md similarity index 100% rename from docs/es/console-commands.md rename to docs/guide/es/console-commands.md diff --git a/docs/es/installation.md b/docs/guide/es/installation.md similarity index 100% rename from docs/es/installation.md rename to docs/guide/es/installation.md diff --git a/docs/es/reading-schema.md b/docs/guide/es/reading-schema.md similarity index 100% rename from docs/es/reading-schema.md rename to docs/guide/es/reading-schema.md diff --git a/docs/ru/README.md b/docs/guide/ru/README.md similarity index 100% rename from docs/ru/README.md rename to docs/guide/ru/README.md diff --git a/docs/ru/console-commands.md b/docs/guide/ru/console-commands.md similarity index 100% rename from docs/ru/console-commands.md rename to docs/guide/ru/console-commands.md diff --git a/docs/ru/installation.md b/docs/guide/ru/installation.md similarity index 100% rename from docs/ru/installation.md rename to docs/guide/ru/installation.md diff --git a/docs/ru/reading-schema.md b/docs/guide/ru/reading-schema.md similarity index 100% rename from docs/ru/reading-schema.md rename to docs/guide/ru/reading-schema.md diff --git a/docs/internals.md b/docs/internals.md new file mode 100644 index 00000000..6ef50daf --- /dev/null +++ b/docs/internals.md @@ -0,0 +1,40 @@ +# Internals + +## Unit testing + +The package is tested with [PHPUnit](https://phpunit.de/). To run tests: + +```shell +./vendor/bin/phpunit +``` + +## Mutation testing + +The package tests are checked with [Infection](https://infection.github.io/) mutation framework with +[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it: + +```shell +./vendor/bin/roave-infection-static-analysis-plugin +``` + +## Static analysis + +The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis: + +```shell +./vendor/bin/psalm +``` + +## Code style + +Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or +use either newest or any specific version of PHP: + +```shell +./vendor/bin/rector +``` + +## Dependencies + +Use [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker) to detect transitive +[Composer](https://getcomposer.org/) dependencies. From 0a5acf25076981c1a670c771fa6337db139da651 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 13:41:29 +0500 Subject: [PATCH 02/24] Update PR template [skip ci] --- .github/PULL_REQUEST_TEMPLATE.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4a3e8ace..6be5d587 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,4 +3,3 @@ | Is bugfix? | ✔️/❌ | New feature? | ✔️/❌ | Breaks BC? | ✔️/❌ -| Fixed issues | comma-separated list of tickets # fixed by the PR, if any From d231651d91a5ec1a3a3eb3baab8a6cbee40d946b Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 13:50:11 +0500 Subject: [PATCH 03/24] Add composer require checker --- .../workflows/composer-require-checker.yml | 34 +++++++++++++++++++ composer.json | 1 + 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/composer-require-checker.yml diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml new file mode 100644 index 00000000..a3cabb90 --- /dev/null +++ b/.github/workflows/composer-require-checker.yml @@ -0,0 +1,34 @@ +on: + pull_request: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'phpunit.xml.dist' + - 'psalm.xml' + + push: + branches: ['master'] + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'phpunit.xml.dist' + - 'psalm.xml' + +name: Composer require checker + +jobs: + composer-require-checker: + uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master + with: + os: >- + ['ubuntu-latest'] + php: >- + ['8.3'] diff --git a/composer.json b/composer.json index 98e721b9..a7818337 100644 --- a/composer.json +++ b/composer.json @@ -40,6 +40,7 @@ "require-dev": { "cycle/entity-behavior": "^1.0", "jetbrains/phpstorm-attributes": "^1.0", + "maglnet/composer-require-checker": "^4.7", "phpunit/phpunit": "^9.6", "roave/infection-static-analysis-plugin": "^1.25", "spatie/phpunit-watcher": "^1.23", From 85f8afc8f72da77358e76b2fcb7f4585540f5eef Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 13:51:56 +0500 Subject: [PATCH 04/24] Change version for CRC --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a7818337..bad47491 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "require-dev": { "cycle/entity-behavior": "^1.0", "jetbrains/phpstorm-attributes": "^1.0", - "maglnet/composer-require-checker": "^4.7", + "maglnet/composer-require-checker": "^4.3", "phpunit/phpunit": "^9.6", "roave/infection-static-analysis-plugin": "^1.25", "spatie/phpunit-watcher": "^1.23", From 147db28f822a033f65917c5581abf66f51018de6 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 14:27:03 +0500 Subject: [PATCH 05/24] Fix CRC (WIP), use symfony/console directly --- composer-require-checker.json | 19 +++++++++++++++++++ composer.json | 4 ++-- src/Command/Migration/CreateCommand.php | 3 +-- src/Command/Migration/DownCommand.php | 7 +++---- src/Command/Migration/GenerateCommand.php | 9 ++++----- src/Command/Migration/ListCommand.php | 3 +-- src/Command/Migration/UpCommand.php | 7 +++---- src/Command/Schema/SchemaClearCommand.php | 3 +-- src/Command/Schema/SchemaCommand.php | 3 +-- src/Command/Schema/SchemaPhpCommand.php | 3 +-- src/Command/Schema/SchemaRebuildCommand.php | 3 +-- tests/Command/Migration/CreateCommandTest.php | 6 +++--- tests/Command/Migration/DownCommandTest.php | 8 ++++---- .../Command/Migration/GenerateCommandTest.php | 12 ++++++------ tests/Command/Migration/ListCommandTest.php | 4 ++-- tests/Command/Migration/UpCommandTest.php | 8 ++++---- .../Command/Schema/SchemaClearCommandTest.php | 4 ++-- tests/Command/Schema/SchemaCommandTest.php | 6 +++--- tests/Command/Schema/SchemaPhpCommandTest.php | 8 ++++---- .../Schema/SchemaRebuildCommandTest.php | 4 ++-- 20 files changed, 67 insertions(+), 57 deletions(-) create mode 100644 composer-require-checker.json diff --git a/composer-require-checker.json b/composer-require-checker.json new file mode 100644 index 00000000..1e55a319 --- /dev/null +++ b/composer-require-checker.json @@ -0,0 +1,19 @@ +{ + "symbol-whitelist" : [ + "JetBrains\\PhpStorm\\ExpectedValues", + "JetBrains\\PhpStorm\\Pure" + ], + "php-core-extensions" : [ + "Core", + "date", + "json", + "hash", + "pcre", + "Phar", + "Reflection", + "SPL", + "random", + "standard" + ], + "scan-files" : [] +} diff --git a/composer.json b/composer.json index bad47491..149ee995 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": "^8.0", + "php": "^8.1", "cycle/annotated": "^3.2.1", "cycle/migrations": "^3.1.1|^4.0", "cycle/orm": "^2.2.2", @@ -35,7 +35,7 @@ "yiisoft/aliases": "^1.1|^2.0|^3.0", "yiisoft/friendly-exception": "^1.1", "yiisoft/injector": "^1.1", - "yiisoft/yii-console": "^2.0" + "symfony/console": "^6.4" }, "require-dev": { "cycle/entity-behavior": "^1.0", diff --git a/src/Command/Migration/CreateCommand.php b/src/Command/Migration/CreateCommand.php index 9652adb1..6f91b617 100644 --- a/src/Command/Migration/CreateCommand.php +++ b/src/Command/Migration/CreateCommand.php @@ -7,7 +7,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Yiisoft\Yii\Console\ExitCode; final class CreateCommand extends BaseMigrationCommand { @@ -27,6 +26,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->createEmptyMigration($output, $customName); - return ExitCode::OK; + return self::SUCCESS; } } diff --git a/src/Command/Migration/DownCommand.php b/src/Command/Migration/DownCommand.php index e608545a..4e2db995 100644 --- a/src/Command/Migration/DownCommand.php +++ b/src/Command/Migration/DownCommand.php @@ -11,7 +11,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Event\AfterMigrate; use Yiisoft\Yii\Cycle\Event\BeforeMigrate; @@ -40,7 +39,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if (!isset($migration)) { $output->writeln('No migration found for rollback'); - return ExitCode::OK; + return self::SUCCESS; } $migrator = $this->promise->getMigrator(); @@ -54,7 +53,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $qaHelper = $this->getHelper('question'); $question = new ConfirmationQuestion('Revert the above migration? (yes|no) ', false); if (!$qaHelper->ask($input, $output, $question)) { - return ExitCode::OK; + return self::SUCCESS; } } } @@ -74,6 +73,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int } finally { $this->eventDispatcher->dispatch(new AfterMigrate()); } - return ExitCode::OK; + return self::SUCCESS; } } diff --git a/src/Command/Migration/GenerateCommand.php b/src/Command/Migration/GenerateCommand.php index 823d41f9..d60c3b6a 100644 --- a/src/Command/Migration/GenerateCommand.php +++ b/src/Command/Migration/GenerateCommand.php @@ -15,7 +15,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Schema\SchemaConveyorInterface; final class GenerateCommand extends BaseMigrationCommand @@ -31,7 +30,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int foreach ($listAfter as $migration) { if ($migration->getState()->getStatus() !== State::STATUS_EXECUTED) { $output->writeln('Outstanding migrations found, run `migrate/up` first.'); - return ExitCode::OK; + return self::SUCCESS; } } $conveyor = $this->promise->getSchemaConveyor(); @@ -70,19 +69,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int $question = new ConfirmationQuestion('Would you like to create empty migration right now? (Y/n)', true); $answer = $qaHelper->ask($input, $output, $question); if (!$answer) { - return ExitCode::OK; + return self::SUCCESS; } // get the name for a new migration $question = new Question('Please enter an unique name for the new migration: '); $name = $qaHelper->ask($input, $output, $question); if (empty($name)) { $output->writeln('You entered an empty name. Exit'); - return ExitCode::OK; + return self::SUCCESS; } // create an empty migration $this->createEmptyMigration($output, $name); } } - return ExitCode::OK; + return self::SUCCESS; } } diff --git a/src/Command/Migration/ListCommand.php b/src/Command/Migration/ListCommand.php index 1a61ef74..0537bba4 100644 --- a/src/Command/Migration/ListCommand.php +++ b/src/Command/Migration/ListCommand.php @@ -6,7 +6,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Yiisoft\Yii\Console\ExitCode; final class ListCommand extends BaseMigrationCommand { @@ -22,6 +21,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('' . $state->getName() . ' ' . '[' . (self::MIGRATION_STATUS[$state->getStatus()] ?? '?') . ']'); } - return ExitCode::OK; + return self::SUCCESS; } } diff --git a/src/Command/Migration/UpCommand.php b/src/Command/Migration/UpCommand.php index e24d4232..dffd18e1 100644 --- a/src/Command/Migration/UpCommand.php +++ b/src/Command/Migration/UpCommand.php @@ -11,7 +11,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Event\AfterMigrate; use Yiisoft\Yii\Cycle\Event\BeforeMigrate; @@ -42,7 +41,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if (!$exist) { $output->writeln('No migration found for execute'); - return ExitCode::OK; + return self::SUCCESS; } $migrator = $this->promise->getMigrator(); @@ -75,7 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** @var QuestionHelper $qaHelper*/ $qaHelper = $this->getHelper('question'); if (!$qaHelper->ask($input, $output, $question)) { - return ExitCode::OK; + return self::SUCCESS; } } } @@ -97,6 +96,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int } finally { $this->eventDispatcher->dispatch(new AfterMigrate()); } - return ExitCode::OK; + return self::SUCCESS; } } diff --git a/src/Command/Schema/SchemaClearCommand.php b/src/Command/Schema/SchemaClearCommand.php index 305f08b1..d7b893f4 100644 --- a/src/Command/Schema/SchemaClearCommand.php +++ b/src/Command/Schema/SchemaClearCommand.php @@ -7,7 +7,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; final class SchemaClearCommand extends Command @@ -26,6 +25,6 @@ public function __construct(CycleDependencyProxy $promise) protected function execute(InputInterface $input, OutputInterface $output): int { $this->promise->getSchemaProvider()->clear(); - return ExitCode::OK; + return self::SUCCESS; } } diff --git a/src/Command/Schema/SchemaCommand.php b/src/Command/Schema/SchemaCommand.php index f6a91a77..7579e536 100644 --- a/src/Command/Schema/SchemaCommand.php +++ b/src/Command/Schema/SchemaCommand.php @@ -10,7 +10,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; final class SchemaCommand extends Command @@ -56,6 +55,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln(sprintf('Undefined roles: %s', implode(', ', $notFound))); } - return ExitCode::OK; + return self::SUCCESS; } } diff --git a/src/Command/Schema/SchemaPhpCommand.php b/src/Command/Schema/SchemaPhpCommand.php index c3702871..a954895a 100644 --- a/src/Command/Schema/SchemaPhpCommand.php +++ b/src/Command/Schema/SchemaPhpCommand.php @@ -11,7 +11,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Yiisoft\Aliases\Aliases; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; final class SchemaPhpCommand extends Command @@ -59,6 +58,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int } else { $output->write($content); } - return ExitCode::OK; + return self::SUCCESS; } } diff --git a/src/Command/Schema/SchemaRebuildCommand.php b/src/Command/Schema/SchemaRebuildCommand.php index 1cad0e2f..7605ab88 100644 --- a/src/Command/Schema/SchemaRebuildCommand.php +++ b/src/Command/Schema/SchemaRebuildCommand.php @@ -7,7 +7,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; final class SchemaRebuildCommand extends Command @@ -28,6 +27,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $provider->clear(); $provider->read(); - return ExitCode::OK; + return self::SUCCESS; } } diff --git a/tests/Command/Migration/CreateCommandTest.php b/tests/Command/Migration/CreateCommandTest.php index a246ad72..44018d9a 100644 --- a/tests/Command/Migration/CreateCommandTest.php +++ b/tests/Command/Migration/CreateCommandTest.php @@ -10,10 +10,10 @@ use Cycle\Migrations\Exception\RepositoryException; use Cycle\Migrations\Migrator; use Cycle\Migrations\RepositoryInterface; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\BufferedOutput; use Yiisoft\Test\Support\Container\SimpleContainer; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Command\Migration\CreateCommand; @@ -56,7 +56,7 @@ public function testExecute(): void $output = new BufferedOutput(); $code = $command->run(new ArrayInput(['name' => 'foo']), $output); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('New migration file has been created', $output->fetch()); } @@ -81,7 +81,7 @@ public function testCreateEmptyMigrationException(): void $result = $output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Can not create migration', $result); $this->assertStringContainsString('test', $result); } diff --git a/tests/Command/Migration/DownCommandTest.php b/tests/Command/Migration/DownCommandTest.php index 2b91d0f9..2c9ef4c3 100644 --- a/tests/Command/Migration/DownCommandTest.php +++ b/tests/Command/Migration/DownCommandTest.php @@ -9,6 +9,7 @@ use Cycle\Migrations\Migrator; use Cycle\Migrations\RepositoryInterface; use Psr\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\ArrayInput; @@ -16,7 +17,6 @@ use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Question\ConfirmationQuestion; use Yiisoft\Test\Support\Container\SimpleContainer; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Command\Migration\DownCommand; use Yiisoft\Yii\Cycle\Command\Migration\UpCommand; @@ -38,7 +38,7 @@ public function testExecuteWithoutMigrations(): void ); $code = $command->run(new ArrayInput([]), $output); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('No migration found for rollback', $output->fetch()); } @@ -68,7 +68,7 @@ public function testExecute(): void $result = $output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Total 1 migration(s) found', $result); $this->assertStringContainsString('test: pending', $result); } @@ -143,7 +143,7 @@ public function testAbortRollback(): void $result = $output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Total 1 migration(s) found', $result); $this->assertStringNotContainsString('test: pending', $result); } diff --git a/tests/Command/Migration/GenerateCommandTest.php b/tests/Command/Migration/GenerateCommandTest.php index 0a21b5d6..769e5884 100644 --- a/tests/Command/Migration/GenerateCommandTest.php +++ b/tests/Command/Migration/GenerateCommandTest.php @@ -9,6 +9,7 @@ use Cycle\Migrations\Config\MigrationConfig; use Cycle\Migrations\Migrator; use Cycle\Migrations\RepositoryInterface; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\ArrayInput; @@ -16,7 +17,6 @@ use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; use Yiisoft\Test\Support\Container\SimpleContainer; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Command\Migration\GenerateCommand; use Yiisoft\Yii\Cycle\Schema\SchemaConveyorInterface; @@ -39,7 +39,7 @@ public function testExecuteWithOutstandingMigrations(): void ); $code = $command->run(new ArrayInput([]), $output); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Outstanding migrations found, run `migrate/up` first.', $output->fetch()); } @@ -64,7 +64,7 @@ public function testExecuteWithoutChanges(): void $result = $output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Added 0 file(s)', $result); $this->assertStringContainsString( 'If you want to create new empty migration, use migrate/create', @@ -96,7 +96,7 @@ public function testExecute(): void $result = $output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Added 1 file(s)', $result); $this->assertStringContainsString('test', $result); } @@ -163,7 +163,7 @@ public function testExecuteWithoutChangesWithCreatingNewMigration(): void $result = $output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Added 0 file(s)', $result); $this->assertStringContainsString( 'If you want to create new empty migration, use migrate/create', @@ -214,7 +214,7 @@ public function testExecuteWithoutChangesWithCreatingNewMigrationEmptyName(): vo $result = $output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Added 0 file(s)', $result); $this->assertStringContainsString('You entered an empty name. Exit', $result); } diff --git a/tests/Command/Migration/ListCommandTest.php b/tests/Command/Migration/ListCommandTest.php index 20f2df15..6815c903 100644 --- a/tests/Command/Migration/ListCommandTest.php +++ b/tests/Command/Migration/ListCommandTest.php @@ -7,10 +7,10 @@ use Cycle\Migrations\Config\MigrationConfig; use Cycle\Migrations\Migrator; use Cycle\Migrations\RepositoryInterface; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\BufferedOutput; use Yiisoft\Test\Support\Container\SimpleContainer; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Command\Migration\ListCommand; @@ -35,7 +35,7 @@ public function testExecute(): void $result = $output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Total 1 migration(s) found', $result); $this->assertStringContainsString('test [pending]', $result); } diff --git a/tests/Command/Migration/UpCommandTest.php b/tests/Command/Migration/UpCommandTest.php index 86218fd1..c63bdb6a 100644 --- a/tests/Command/Migration/UpCommandTest.php +++ b/tests/Command/Migration/UpCommandTest.php @@ -8,13 +8,13 @@ use Cycle\Migrations\Migrator; use Cycle\Migrations\RepositoryInterface; use Psr\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Question\ConfirmationQuestion; use Yiisoft\Test\Support\Container\SimpleContainer; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Command\Migration\UpCommand; @@ -39,7 +39,7 @@ public function testExecuteWithoutMigrations(): void ); $code = $command->run(new ArrayInput([]), $output); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('No migration found for execute', $output->fetch()); } @@ -68,7 +68,7 @@ public function testExecute(): void $result = $output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Migration to be applied:', $result); $this->assertStringContainsString('test: executed', $result); } @@ -115,7 +115,7 @@ public function testAbortMigrate(array $migrations, string $question): void $result = $output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString( \count($migrations) === 1 ? 'Migration to be applied:' : '2 migrations to be applied:', $result diff --git a/tests/Command/Schema/SchemaClearCommandTest.php b/tests/Command/Schema/SchemaClearCommandTest.php index f3709f98..4676108f 100644 --- a/tests/Command/Schema/SchemaClearCommandTest.php +++ b/tests/Command/Schema/SchemaClearCommandTest.php @@ -6,10 +6,10 @@ use Cycle\Schema\Provider\SchemaProviderInterface; use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Yiisoft\Test\Support\Container\SimpleContainer; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Command\Schema\SchemaClearCommand; @@ -27,6 +27,6 @@ public function testExecute(): void $code = $command->run($input, $output); - $this->assertEquals(ExitCode::OK, $code); + $this->assertEquals(Command::SUCCESS, $code); } } diff --git a/tests/Command/Schema/SchemaCommandTest.php b/tests/Command/Schema/SchemaCommandTest.php index a4708a6e..5c62f4c8 100644 --- a/tests/Command/Schema/SchemaCommandTest.php +++ b/tests/Command/Schema/SchemaCommandTest.php @@ -6,10 +6,10 @@ use Cycle\ORM\SchemaInterface; use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\BufferedOutput; use Yiisoft\Test\Support\Container\SimpleContainer; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Command\Schema\SchemaCommand; @@ -33,7 +33,7 @@ public function testExecuteUndefinedRoles(): void $code = $command->run(new ArrayInput(['role' => 'foo,bar']), $this->output); - $this->assertEquals(ExitCode::OK, $code); + $this->assertEquals(Command::SUCCESS, $code); $this->assertStringContainsString('Undefined roles: foo, bar', $this->output->fetch()); } @@ -51,7 +51,7 @@ public function testExecuteGetRoles(): void $code = $command->run(new ArrayInput([]), $this->output); - $this->assertEquals(ExitCode::OK, $code); + $this->assertEquals(Command::SUCCESS, $code); $this->assertStringNotContainsString('Undefined roles', $this->output->fetch()); } } diff --git a/tests/Command/Schema/SchemaPhpCommandTest.php b/tests/Command/Schema/SchemaPhpCommandTest.php index ef285d59..9661e72f 100644 --- a/tests/Command/Schema/SchemaPhpCommandTest.php +++ b/tests/Command/Schema/SchemaPhpCommandTest.php @@ -6,11 +6,11 @@ use Cycle\ORM\SchemaInterface; use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\BufferedOutput; use Yiisoft\Aliases\Aliases; use Yiisoft\Test\Support\Container\SimpleContainer; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Command\Schema\SchemaPhpCommand; @@ -38,7 +38,7 @@ public function testExecuteWithoutFile(): void $code = $command->run(new ArrayInput([]), $this->output); $result = $this->output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString('Schema::ROLE => \'foo\'', $result); $this->assertStringContainsString('Schema::ROLE => \'bar\'', $result); } @@ -60,7 +60,7 @@ public function testExecuteWithFile(): void $code = $command->run(new ArrayInput(['file' => $file]), $this->output); $result = $this->output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString(sprintf('Destination: %s', $file), $result); $this->assertStringContainsString('Schema::ROLE => \'foo\'', file_get_contents($file)); @@ -88,7 +88,7 @@ public function testExecuteWithFileAndAlias(): void $code = $command->run(new ArrayInput(['file' => '@test/alias-schema.php']), $this->output); $result = $this->output->fetch(); - $this->assertSame(ExitCode::OK, $code); + $this->assertSame(Command::SUCCESS, $code); $this->assertStringContainsString(sprintf('Destination: %s', $file), $result); $this->assertStringContainsString('Schema::ROLE => \'foo\'', file_get_contents($file)); diff --git a/tests/Command/Schema/SchemaRebuildCommandTest.php b/tests/Command/Schema/SchemaRebuildCommandTest.php index ce07d5fe..753ba360 100644 --- a/tests/Command/Schema/SchemaRebuildCommandTest.php +++ b/tests/Command/Schema/SchemaRebuildCommandTest.php @@ -6,10 +6,10 @@ use Cycle\Schema\Provider\SchemaProviderInterface; use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\BufferedOutput; use Yiisoft\Test\Support\Container\SimpleContainer; -use Yiisoft\Yii\Console\ExitCode; use Yiisoft\Yii\Cycle\Command\CycleDependencyProxy; use Yiisoft\Yii\Cycle\Command\Schema\SchemaRebuildCommand; @@ -28,6 +28,6 @@ public function testExecute() $code = $command->run(new ArrayInput([]), new BufferedOutput()); - $this->assertEquals(ExitCode::OK, $code); + $this->assertEquals(Command::SUCCESS, $code); } } From ca8a7561a8aeee3925e5be51cddc411be67c65da Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 14:45:36 +0500 Subject: [PATCH 06/24] Remove remaining ExitCode occurence --- src/Command/Schema/SchemaPhpCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Schema/SchemaPhpCommand.php b/src/Command/Schema/SchemaPhpCommand.php index a954895a..f983dab3 100644 --- a/src/Command/Schema/SchemaPhpCommand.php +++ b/src/Command/Schema/SchemaPhpCommand.php @@ -53,7 +53,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int throw new \RuntimeException("Directory {$dir} not found"); } if (file_put_contents($file, $content) === false) { - return ExitCode::UNSPECIFIED_ERROR; + return self::FAILURE; } } else { $output->write($content); From dd8cfc3ad6c71103a89cb908c8ba15d2257b319b Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 14:50:16 +0500 Subject: [PATCH 07/24] Exclude PHP 8.0 from CI --- .github/workflows/build.yml | 1 - .github/workflows/mutation.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 70fbcf29..622db1f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,6 @@ jobs: - windows-latest php: - - 8.0 - 8.1 - 8.2 - 8.3 diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 03b72c09..842c6ae9 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -26,6 +26,6 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.2'] + ['8.3'] secrets: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} From bf096e8b0d20a682ed8a1082aac6b68ddcbccc53 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 14:57:16 +0500 Subject: [PATCH 08/24] Add symfony finder as a dependency --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 149ee995..42ee7a2c 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,8 @@ "yiisoft/aliases": "^1.1|^2.0|^3.0", "yiisoft/friendly-exception": "^1.1", "yiisoft/injector": "^1.1", - "symfony/console": "^6.4" + "symfony/console": "^6.4", + "symfony/finder":"^5.4" }, "require-dev": { "cycle/entity-behavior": "^1.0", From 9b883f81fdc53fe6d31d84e54cdd5cbb0e8509eb Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 15:04:55 +0500 Subject: [PATCH 09/24] Add cycle/database dependency, bump versions --- composer.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 42ee7a2c..f7729c0f 100644 --- a/composer.json +++ b/composer.json @@ -21,17 +21,18 @@ "prefer-stable": true, "require": { "php": "^8.1", - "cycle/annotated": "^3.2.1", + "cycle/annotated": "^3.5", + "cycle/database": "^2.8", "cycle/migrations": "^3.1.1|^4.0", - "cycle/orm": "^2.2.2", + "cycle/orm": "^2.7", "cycle/schema-migrations-generator": "^2.0", "cycle/schema-renderer": "^1.2", - "cycle/schema-builder": "^2.7", + "cycle/schema-builder": "^2.8", "cycle/schema-provider": "^1.0", "psr/event-dispatcher": "^1.0", "psr/simple-cache": "^2.0|^3.0", "spiral/attributes": "^2.7|^3.0", - "webmozart/glob": "^4.0", + "webmozart/glob": "^4.7", "yiisoft/aliases": "^1.1|^2.0|^3.0", "yiisoft/friendly-exception": "^1.1", "yiisoft/injector": "^1.1", From bed44c6601cc055bec75b78727b269849200cff2 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 17:51:10 +0500 Subject: [PATCH 10/24] Fix remaining CRC issues --- composer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/composer.json b/composer.json index f7729c0f..66bb5700 100644 --- a/composer.json +++ b/composer.json @@ -29,9 +29,13 @@ "cycle/schema-renderer": "^1.2", "cycle/schema-builder": "^2.8", "cycle/schema-provider": "^1.0", + "psr/container": "^2.0", "psr/event-dispatcher": "^1.0", + "psr/log": "^3.0", "psr/simple-cache": "^2.0|^3.0", "spiral/attributes": "^2.7|^3.0", + "spiral/core": "^3.12", + "spiral/tokenizer": "^3.12", "webmozart/glob": "^4.7", "yiisoft/aliases": "^1.1|^2.0|^3.0", "yiisoft/friendly-exception": "^1.1", From 1d4f4ea0fbc838aaf49691fe22a91c61526fc233 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 18:00:14 +0500 Subject: [PATCH 11/24] Add rector --- .github/workflows/bc.yml_ | 21 ++++++++++----------- .github/workflows/rector.yml | 21 +++++++++++++++++++++ composer.json | 1 + rector.php | 27 +++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/rector.yml create mode 100644 rector.php diff --git a/.github/workflows/bc.yml_ b/.github/workflows/bc.yml_ index 35b3a862..6b506228 100644 --- a/.github/workflows/bc.yml_ +++ b/.github/workflows/bc.yml_ @@ -1,15 +1,14 @@ on: - - pull_request - - push + - pull_request + - push name: backwards compatibility + jobs: - roave_bc_check: - name: Roave BC Check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: fetch tags - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - name: Roave BC Check - uses: docker://nyholm/roave-bc-check-ga + roave_bc_check: + uses: yiisoft/actions/.github/workflows/bc.yml@master + with: + os: >- + ['ubuntu-latest'] + php: >- + ['8.3'] diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml new file mode 100644 index 00000000..2f1499c3 --- /dev/null +++ b/.github/workflows/rector.yml @@ -0,0 +1,21 @@ +on: + pull_request: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'psalm.xml' + +name: rector + +jobs: + rector: + uses: yiisoft/actions/.github/workflows/rector.yml@master + with: + os: >- + ['ubuntu-latest'] + php: >- + ['8.3'] diff --git a/composer.json b/composer.json index 66bb5700..ebe49884 100644 --- a/composer.json +++ b/composer.json @@ -48,6 +48,7 @@ "jetbrains/phpstorm-attributes": "^1.0", "maglnet/composer-require-checker": "^4.3", "phpunit/phpunit": "^9.6", + "rector/rector": "^1.0", "roave/infection-static-analysis-plugin": "^1.25", "spatie/phpunit-watcher": "^1.23", "vimeo/psalm": "^4.30|^5.7", diff --git a/rector.php b/rector.php new file mode 100644 index 00000000..f55daaed --- /dev/null +++ b/rector.php @@ -0,0 +1,27 @@ +paths([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]); + + // register a single rule + $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); + + // define sets of rules + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_80, + ]); + + $rectorConfig->skip([ + ClosureToArrowFunctionRector::class, + ]); +}; From 3c63b9e369664f48d1c487b858f63f4213a7c396 Mon Sep 17 00:00:00 2001 From: arogachev Date: Tue, 12 Mar 2024 13:00:59 +0000 Subject: [PATCH 12/24] Apply Rector changes (CI) --- src/Command/CycleDependencyProxy.php | 5 +---- src/Command/Migration/BaseMigrationCommand.php | 7 +------ src/Command/Migration/DownCommand.php | 5 +---- src/Command/Migration/UpCommand.php | 5 +---- src/Command/Schema/SchemaClearCommand.php | 5 +---- src/Command/Schema/SchemaCommand.php | 5 +---- src/Command/Schema/SchemaPhpCommand.php | 7 +------ src/Command/Schema/SchemaRebuildCommand.php | 4 +--- src/Exception/BadDeclarationException.php | 2 +- src/Factory/CycleDynamicFactory.php | 5 +---- src/Factory/MigrationConfigFactory.php | 5 +---- src/Factory/OrmFactory.php | 13 ++++++------- src/Schema/Conveyor/SchemaConveyor.php | 5 +---- tests/Feature/Schema/Conveyor/BaseConveyor.php | 2 +- .../Feature/Schema/Conveyor/SchemaConveyorTest.php | 2 +- .../Feature/Schema/Conveyor/Stub/FakeGenerator.php | 5 +---- tests/Feature/Schema/Stub/ArraySchemaProvider.php | 5 +---- tests/Unit/Factory/OrmFactory/BaseOrmFactory.php | 3 --- tests/Unit/Listener/Stub/CallingSpyProvider.php | 4 +--- 19 files changed, 23 insertions(+), 71 deletions(-) diff --git a/src/Command/CycleDependencyProxy.php b/src/Command/CycleDependencyProxy.php index 4f9a558d..f5733154 100644 --- a/src/Command/CycleDependencyProxy.php +++ b/src/Command/CycleDependencyProxy.php @@ -15,11 +15,8 @@ final class CycleDependencyProxy { - private ContainerInterface $container; - - public function __construct(ContainerInterface $container) + public function __construct(private ContainerInterface $container) { - $this->container = $container; } public function getDatabaseProvider(): DatabaseProviderInterface diff --git a/src/Command/Migration/BaseMigrationCommand.php b/src/Command/Migration/BaseMigrationCommand.php index 6ff0f52d..2506f56e 100644 --- a/src/Command/Migration/BaseMigrationCommand.php +++ b/src/Command/Migration/BaseMigrationCommand.php @@ -14,17 +14,14 @@ abstract class BaseMigrationCommand extends Command { - protected CycleDependencyProxy $promise; - protected const MIGRATION_STATUS = [ State::STATUS_UNDEFINED => 'undefined', State::STATUS_PENDING => 'pending', State::STATUS_EXECUTED => 'executed', ]; - public function __construct(CycleDependencyProxy $promise) + public function __construct(protected CycleDependencyProxy $promise) { - $this->promise = $promise; parent::__construct(); } @@ -62,8 +59,6 @@ protected function createEmptyMigration( } /** - * @param OutputInterface $output - * * @return MigrationInterface[] */ protected function findMigrations(OutputInterface $output): array diff --git a/src/Command/Migration/DownCommand.php b/src/Command/Migration/DownCommand.php index 4e2db995..2a23543c 100644 --- a/src/Command/Migration/DownCommand.php +++ b/src/Command/Migration/DownCommand.php @@ -20,11 +20,8 @@ final class DownCommand extends BaseMigrationCommand protected static $defaultName = 'migrate/down'; protected static $defaultDescription = 'Rolls back the last applied migration'; - private EventDispatcherInterface $eventDispatcher; - - public function __construct(CycleDependencyProxy $promise, EventDispatcherInterface $eventDispatcher) + public function __construct(CycleDependencyProxy $promise, private EventDispatcherInterface $eventDispatcher) { - $this->eventDispatcher = $eventDispatcher; parent::__construct($promise); } diff --git a/src/Command/Migration/UpCommand.php b/src/Command/Migration/UpCommand.php index dffd18e1..173fa872 100644 --- a/src/Command/Migration/UpCommand.php +++ b/src/Command/Migration/UpCommand.php @@ -20,11 +20,8 @@ final class UpCommand extends BaseMigrationCommand protected static $defaultName = 'migrate/up'; protected static $defaultDescription = 'Executes all new migrations'; - private EventDispatcherInterface $eventDispatcher; - - public function __construct(CycleDependencyProxy $promise, EventDispatcherInterface $eventDispatcher) + public function __construct(CycleDependencyProxy $promise, private EventDispatcherInterface $eventDispatcher) { - $this->eventDispatcher = $eventDispatcher; parent::__construct($promise); } diff --git a/src/Command/Schema/SchemaClearCommand.php b/src/Command/Schema/SchemaClearCommand.php index d7b893f4..15374149 100644 --- a/src/Command/Schema/SchemaClearCommand.php +++ b/src/Command/Schema/SchemaClearCommand.php @@ -14,11 +14,8 @@ final class SchemaClearCommand extends Command protected static $defaultName = 'cycle/schema/clear'; protected static $defaultDescription = 'Clears the current schema cache'; - private CycleDependencyProxy $promise; - - public function __construct(CycleDependencyProxy $promise) + public function __construct(private CycleDependencyProxy $promise) { - $this->promise = $promise; parent::__construct(); } diff --git a/src/Command/Schema/SchemaCommand.php b/src/Command/Schema/SchemaCommand.php index 7579e536..6a731ddc 100644 --- a/src/Command/Schema/SchemaCommand.php +++ b/src/Command/Schema/SchemaCommand.php @@ -17,11 +17,8 @@ final class SchemaCommand extends Command protected static $defaultName = 'cycle/schema'; protected static $defaultDescription = 'Shown current schema'; - private CycleDependencyProxy $promise; - - public function __construct(CycleDependencyProxy $promise) + public function __construct(private CycleDependencyProxy $promise) { - $this->promise = $promise; parent::__construct(); } diff --git a/src/Command/Schema/SchemaPhpCommand.php b/src/Command/Schema/SchemaPhpCommand.php index f983dab3..31b8aa11 100644 --- a/src/Command/Schema/SchemaPhpCommand.php +++ b/src/Command/Schema/SchemaPhpCommand.php @@ -18,13 +18,8 @@ final class SchemaPhpCommand extends Command protected static $defaultName = 'cycle/schema/php'; protected static $defaultDescription = 'Saves the current schema in a PHP file'; - private CycleDependencyProxy $promise; - private Aliases $aliases; - - public function __construct(Aliases $aliases, CycleDependencyProxy $promise) + public function __construct(private Aliases $aliases, private CycleDependencyProxy $promise) { - $this->aliases = $aliases; - $this->promise = $promise; parent::__construct(); } diff --git a/src/Command/Schema/SchemaRebuildCommand.php b/src/Command/Schema/SchemaRebuildCommand.php index 7605ab88..aa7544be 100644 --- a/src/Command/Schema/SchemaRebuildCommand.php +++ b/src/Command/Schema/SchemaRebuildCommand.php @@ -13,11 +13,9 @@ final class SchemaRebuildCommand extends Command { protected static $defaultName = 'cycle/schema/rebuild'; protected static $defaultDescription = 'Rebuilds the database schema'; - private CycleDependencyProxy $promise; - public function __construct(CycleDependencyProxy $promise) + public function __construct(private CycleDependencyProxy $promise) { - $this->promise = $promise; parent::__construct(); } diff --git a/src/Exception/BadDeclarationException.php b/src/Exception/BadDeclarationException.php index ff809376..d5f64934 100644 --- a/src/Exception/BadDeclarationException.php +++ b/src/Exception/BadDeclarationException.php @@ -15,7 +15,7 @@ class BadDeclarationException extends Exception public function __construct(string $parameter, string $class, mixed $argument) { $type = \is_object($argument) - ? 'Instance of ' . \get_class($argument) + ? 'Instance of ' . $argument::class : \ucfirst(\get_debug_type($argument)); parent::__construct(\sprintf( '%s should be instance of %s or its declaration. %s was received instead.', diff --git a/src/Factory/CycleDynamicFactory.php b/src/Factory/CycleDynamicFactory.php index cb5cbdf0..e939dcba 100644 --- a/src/Factory/CycleDynamicFactory.php +++ b/src/Factory/CycleDynamicFactory.php @@ -9,11 +9,8 @@ final class CycleDynamicFactory implements FactoryInterface { - private Injector $injector; - - public function __construct(Injector $injector) + public function __construct(private Injector $injector) { - $this->injector = $injector; } public function make(string $alias, array $parameters = []): mixed diff --git a/src/Factory/MigrationConfigFactory.php b/src/Factory/MigrationConfigFactory.php index 4cf62ec9..cde6cfdb 100644 --- a/src/Factory/MigrationConfigFactory.php +++ b/src/Factory/MigrationConfigFactory.php @@ -10,11 +10,8 @@ final class MigrationConfigFactory { - private array $params; - - public function __construct(array $params) + public function __construct(private array $params) { - $this->params = $params; } public function __invoke(ContainerInterface $container): MigrationConfig diff --git a/src/Factory/OrmFactory.php b/src/Factory/OrmFactory.php index 618e8b9b..7187b8c6 100644 --- a/src/Factory/OrmFactory.php +++ b/src/Factory/OrmFactory.php @@ -24,17 +24,16 @@ */ final class OrmFactory { - /** - * @psalm-var CollectionsConfig - */ - private array $collectionsConfig; - /** * @param CollectionsConfig $collectionsConfig */ - public function __construct(array $collectionsConfig) + public function __construct( + /** + * @psalm-var CollectionsConfig + */ + private array $collectionsConfig + ) { - $this->collectionsConfig = $collectionsConfig; } /** diff --git a/src/Schema/Conveyor/SchemaConveyor.php b/src/Schema/Conveyor/SchemaConveyor.php index 693c3f53..a0975177 100644 --- a/src/Schema/Conveyor/SchemaConveyor.php +++ b/src/Schema/Conveyor/SchemaConveyor.php @@ -31,11 +31,8 @@ abstract class SchemaConveyor implements SchemaConveyorInterface ], ]; - protected ContainerInterface $container; - - public function __construct(ContainerInterface $container) + public function __construct(protected ContainerInterface $container) { - $this->container = $container; } public function addGenerator(string $stage, $generator): void diff --git a/tests/Feature/Schema/Conveyor/BaseConveyor.php b/tests/Feature/Schema/Conveyor/BaseConveyor.php index 321ccce0..e491ce0d 100644 --- a/tests/Feature/Schema/Conveyor/BaseConveyor.php +++ b/tests/Feature/Schema/Conveyor/BaseConveyor.php @@ -46,7 +46,7 @@ public function testAddWrongGenerator($badGenerator, string $message): void protected function getGeneratorClassList(SchemaConveyorInterface $conveyor): array { return array_map( - fn ($value) => $value instanceof FakeGenerator ? $value->originClass() : get_class($value), + fn ($value) => $value instanceof FakeGenerator ? $value->originClass() : $value::class, $conveyor->getGenerators() ); } diff --git a/tests/Feature/Schema/Conveyor/SchemaConveyorTest.php b/tests/Feature/Schema/Conveyor/SchemaConveyorTest.php index 48c10d3a..775f9a60 100644 --- a/tests/Feature/Schema/Conveyor/SchemaConveyorTest.php +++ b/tests/Feature/Schema/Conveyor/SchemaConveyorTest.php @@ -61,7 +61,7 @@ public function __invoke(): GeneratorInterface // get generators list /** @var string[] $generators */ $generators = array_map( - fn ($value) => $value instanceof FakeGenerator ? $value->originClass() : get_class($value), + fn ($value) => $value instanceof FakeGenerator ? $value->originClass() : $value::class, $conveyor->getGenerators() ); diff --git a/tests/Feature/Schema/Conveyor/Stub/FakeGenerator.php b/tests/Feature/Schema/Conveyor/Stub/FakeGenerator.php index 5bdd068e..52c3593f 100644 --- a/tests/Feature/Schema/Conveyor/Stub/FakeGenerator.php +++ b/tests/Feature/Schema/Conveyor/Stub/FakeGenerator.php @@ -9,11 +9,8 @@ class FakeGenerator implements GeneratorInterface { - private string $originClass; - - public function __construct(string $originClass) + public function __construct(private string $originClass) { - $this->originClass = $originClass; } public function run(Registry $registry): Registry diff --git a/tests/Feature/Schema/Stub/ArraySchemaProvider.php b/tests/Feature/Schema/Stub/ArraySchemaProvider.php index a00c28d5..05096202 100644 --- a/tests/Feature/Schema/Stub/ArraySchemaProvider.php +++ b/tests/Feature/Schema/Stub/ArraySchemaProvider.php @@ -8,11 +8,8 @@ final class ArraySchemaProvider implements SchemaProviderInterface { - protected ?array $schema; - - public function __construct(array $schema = null) + public function __construct(protected ?array $schema = null) { - $this->schema = $schema; } /** diff --git a/tests/Unit/Factory/OrmFactory/BaseOrmFactory.php b/tests/Unit/Factory/OrmFactory/BaseOrmFactory.php index a2dc78bd..7252afbc 100644 --- a/tests/Unit/Factory/OrmFactory/BaseOrmFactory.php +++ b/tests/Unit/Factory/OrmFactory/BaseOrmFactory.php @@ -62,9 +62,6 @@ function (string $id) { ); } - /** - * @param array $collectionsConfig - */ protected function makeFactory(array $collectionsConfig = []): \Cycle\ORM\FactoryInterface { return (new OrmFactory($collectionsConfig))( diff --git a/tests/Unit/Listener/Stub/CallingSpyProvider.php b/tests/Unit/Listener/Stub/CallingSpyProvider.php index 87a31213..01ffd891 100644 --- a/tests/Unit/Listener/Stub/CallingSpyProvider.php +++ b/tests/Unit/Listener/Stub/CallingSpyProvider.php @@ -11,11 +11,9 @@ class CallingSpyProvider implements SchemaProviderInterface private int $read = 0; private int $write = 0; private int $clear = 0; - private ?array $schema; - public function __construct(array $schema = null) + public function __construct(private ?array $schema = null) { - $this->schema = $schema; } public function withConfig(array $config): self From 7ba3f1145816ecb0001469b058dde69eb62b361c Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Tue, 12 Mar 2024 13:01:07 +0000 Subject: [PATCH 13/24] Apply fixes from StyleCI --- src/Factory/OrmFactory.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Factory/OrmFactory.php b/src/Factory/OrmFactory.php index 7187b8c6..16ad5c92 100644 --- a/src/Factory/OrmFactory.php +++ b/src/Factory/OrmFactory.php @@ -32,8 +32,7 @@ public function __construct( * @psalm-var CollectionsConfig */ private array $collectionsConfig - ) - { + ) { } /** From 45c75e0dcca42a1e97a6b184684999404d1be52a Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 18:12:46 +0500 Subject: [PATCH 14/24] Min MSI 100% --- .github/workflows/mutation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 842c6ae9..59335cd1 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -27,5 +27,6 @@ jobs: ['ubuntu-latest'] php: >- ['8.3'] + min-covered-msi: 100 secrets: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} From 1fc08d3fe0a075ef9eb09824ad3d45b2a20d9b39 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 18:33:53 +0500 Subject: [PATCH 15/24] Remove remaining links [skip ci] --- docs/guide/es/README.md | 1 - docs/guide/ru/README.md | 1 - 2 files changed, 2 deletions(-) diff --git a/docs/guide/es/README.md b/docs/guide/es/README.md index 8bab9dfd..9ab0b559 100644 --- a/docs/guide/es/README.md +++ b/docs/guide/es/README.md @@ -8,5 +8,4 @@ Este paquete proporciona una manera conveniente de integrarlo con el framework Y - [Instalación y configuración](installation.md) - [Comandos de consola](console-commands.md) -- [Clase EntityReader](entity-reader.md) - [Lectura del esquema de datos](reading-schema.md) diff --git a/docs/guide/ru/README.md b/docs/guide/ru/README.md index a0438c57..b4fd1799 100644 --- a/docs/guide/ru/README.md +++ b/docs/guide/ru/README.md @@ -9,7 +9,6 @@ Cycle — это DataMapper ORM, спроектированный для без - [Установка и настройка](installation.md) - [Консольные команды](console-commands.md) -- [Класс EntityReader](entity-reader.md) - [Чтение схемы данных](reading-schema.md) # Другие пакеты From 66cdef6a3eda5925ce89f49c486151dc4ee7fe66 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 12 Mar 2024 18:34:58 +0500 Subject: [PATCH 16/24] Remove extra line [skip ci] --- docs/guide/en/reading-schema.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/guide/en/reading-schema.md b/docs/guide/en/reading-schema.md index cc34c552..a95df52e 100644 --- a/docs/guide/en/reading-schema.md +++ b/docs/guide/en/reading-schema.md @@ -12,8 +12,7 @@ In `yii-cycle` package schema can be built from multiple sources represented by In order to use multiple schema providers in turn, grouping `Cycle\Schema\Provider\Support\SchemaProviderPipeline` provider is used. You can configure this provider in `schema-providers` section of a `config/params.php` file. Arrage schema providers in such an order, that caching providers are at the top of the list, -and origin schema providers at the end. - +and origin schema providers at the end. ## Entity attributes based schema From 26113e13cda343653ab7502c4d2f239dd89fb83c Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 13 Mar 2024 12:35:05 +0600 Subject: [PATCH 17/24] Update .github/workflows/composer-require-checker.yml Co-authored-by: Sergei Predvoditelev --- .github/workflows/composer-require-checker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index a3cabb90..a857bce6 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -31,4 +31,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.3'] + ['8.1', '8.2', '8.3'] From c71cfa448a1c79b25589d7c2eb55636ac06d9503 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 13 Mar 2024 12:08:26 +0500 Subject: [PATCH 18/24] Revert some Rector changes --- src/Factory/OrmFactory.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Factory/OrmFactory.php b/src/Factory/OrmFactory.php index 16ad5c92..4b26ab03 100644 --- a/src/Factory/OrmFactory.php +++ b/src/Factory/OrmFactory.php @@ -25,14 +25,10 @@ final class OrmFactory { /** - * @param CollectionsConfig $collectionsConfig + * @psalm-param CollectionsConfig $collectionsConfig */ - public function __construct( - /** - * @psalm-var CollectionsConfig - */ - private array $collectionsConfig - ) { + public function __construct(private array $collectionsConfig) + { } /** From 13a547b8db7034feca88affb8d3376c98d7b37b4 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 13 Mar 2024 12:19:26 +0500 Subject: [PATCH 19/24] Change push rules for CI (review fix) --- .github/workflows/build.yml | 1 + .github/workflows/mutation.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 622db1f8..26b926d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ on: - 'psalm.xml' push: + branches: ['master'] paths-ignore: - 'docs/**' - 'README.md' diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 59335cd1..df1db8d6 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -9,6 +9,7 @@ on: - 'psalm.xml' push: + branches: ['master'] paths-ignore: - 'docs/**' - 'README.md' From e79f0b9ca5680aa0f9897d1e813111d72f3b3d6d Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 13 Mar 2024 13:21:17 +0600 Subject: [PATCH 20/24] Update README.md Co-authored-by: Sergei Predvoditelev --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 319c6ee9..2318ba9f 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,7 @@ Read more in the [official documentation](https://cycle-orm.dev/docs/readme/2.x) ## Documentation -- [English](docs/en/guide) -- [Russian](docs/ru/guide) -- [Spanish](docs/es/guide) +- Guide: [English](docs/en/guide), [Russian](docs/ru/guide), [Spanish](docs/es/guide) - [Internals](docs/internals.md) ## License From e660f64ba7125e1050884b03007c8727a70171c6 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 13 Mar 2024 13:21:26 +0600 Subject: [PATCH 21/24] Update rector.php Co-authored-by: Sergei Predvoditelev --- rector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rector.php b/rector.php index f55daaed..309a502c 100644 --- a/rector.php +++ b/rector.php @@ -18,7 +18,7 @@ // define sets of rules $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_80, + LevelSetList::UP_TO_PHP_81, ]); $rectorConfig->skip([ From 2a33b65e68635afc14f6a3978fde71015a3e051d Mon Sep 17 00:00:00 2001 From: arogachev Date: Wed, 13 Mar 2024 07:21:53 +0000 Subject: [PATCH 22/24] Apply Rector changes (CI) --- src/Command/CycleDependencyProxy.php | 2 +- src/Command/Migration/DownCommand.php | 2 +- src/Command/Migration/UpCommand.php | 2 +- src/Command/Schema/SchemaClearCommand.php | 2 +- src/Command/Schema/SchemaCommand.php | 2 +- src/Command/Schema/SchemaPhpCommand.php | 2 +- src/Command/Schema/SchemaRebuildCommand.php | 2 +- src/Factory/CycleDynamicFactory.php | 2 +- src/Factory/DbalFactory.php | 2 +- src/Factory/RepositoryContainer.php | 2 +- src/Listener/MigrationListener.php | 2 +- tests/Feature/Schema/Conveyor/Stub/FakeGenerator.php | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Command/CycleDependencyProxy.php b/src/Command/CycleDependencyProxy.php index f5733154..84f4bd4f 100644 --- a/src/Command/CycleDependencyProxy.php +++ b/src/Command/CycleDependencyProxy.php @@ -15,7 +15,7 @@ final class CycleDependencyProxy { - public function __construct(private ContainerInterface $container) + public function __construct(private readonly ContainerInterface $container) { } diff --git a/src/Command/Migration/DownCommand.php b/src/Command/Migration/DownCommand.php index 2a23543c..e2881ae1 100644 --- a/src/Command/Migration/DownCommand.php +++ b/src/Command/Migration/DownCommand.php @@ -20,7 +20,7 @@ final class DownCommand extends BaseMigrationCommand protected static $defaultName = 'migrate/down'; protected static $defaultDescription = 'Rolls back the last applied migration'; - public function __construct(CycleDependencyProxy $promise, private EventDispatcherInterface $eventDispatcher) + public function __construct(CycleDependencyProxy $promise, private readonly EventDispatcherInterface $eventDispatcher) { parent::__construct($promise); } diff --git a/src/Command/Migration/UpCommand.php b/src/Command/Migration/UpCommand.php index 173fa872..64f5d0dd 100644 --- a/src/Command/Migration/UpCommand.php +++ b/src/Command/Migration/UpCommand.php @@ -20,7 +20,7 @@ final class UpCommand extends BaseMigrationCommand protected static $defaultName = 'migrate/up'; protected static $defaultDescription = 'Executes all new migrations'; - public function __construct(CycleDependencyProxy $promise, private EventDispatcherInterface $eventDispatcher) + public function __construct(CycleDependencyProxy $promise, private readonly EventDispatcherInterface $eventDispatcher) { parent::__construct($promise); } diff --git a/src/Command/Schema/SchemaClearCommand.php b/src/Command/Schema/SchemaClearCommand.php index 15374149..f7969123 100644 --- a/src/Command/Schema/SchemaClearCommand.php +++ b/src/Command/Schema/SchemaClearCommand.php @@ -14,7 +14,7 @@ final class SchemaClearCommand extends Command protected static $defaultName = 'cycle/schema/clear'; protected static $defaultDescription = 'Clears the current schema cache'; - public function __construct(private CycleDependencyProxy $promise) + public function __construct(private readonly CycleDependencyProxy $promise) { parent::__construct(); } diff --git a/src/Command/Schema/SchemaCommand.php b/src/Command/Schema/SchemaCommand.php index 6a731ddc..5ca397bc 100644 --- a/src/Command/Schema/SchemaCommand.php +++ b/src/Command/Schema/SchemaCommand.php @@ -17,7 +17,7 @@ final class SchemaCommand extends Command protected static $defaultName = 'cycle/schema'; protected static $defaultDescription = 'Shown current schema'; - public function __construct(private CycleDependencyProxy $promise) + public function __construct(private readonly CycleDependencyProxy $promise) { parent::__construct(); } diff --git a/src/Command/Schema/SchemaPhpCommand.php b/src/Command/Schema/SchemaPhpCommand.php index 31b8aa11..5956208e 100644 --- a/src/Command/Schema/SchemaPhpCommand.php +++ b/src/Command/Schema/SchemaPhpCommand.php @@ -18,7 +18,7 @@ final class SchemaPhpCommand extends Command protected static $defaultName = 'cycle/schema/php'; protected static $defaultDescription = 'Saves the current schema in a PHP file'; - public function __construct(private Aliases $aliases, private CycleDependencyProxy $promise) + public function __construct(private readonly Aliases $aliases, private readonly CycleDependencyProxy $promise) { parent::__construct(); } diff --git a/src/Command/Schema/SchemaRebuildCommand.php b/src/Command/Schema/SchemaRebuildCommand.php index aa7544be..5feaa7fe 100644 --- a/src/Command/Schema/SchemaRebuildCommand.php +++ b/src/Command/Schema/SchemaRebuildCommand.php @@ -14,7 +14,7 @@ final class SchemaRebuildCommand extends Command protected static $defaultName = 'cycle/schema/rebuild'; protected static $defaultDescription = 'Rebuilds the database schema'; - public function __construct(private CycleDependencyProxy $promise) + public function __construct(private readonly CycleDependencyProxy $promise) { parent::__construct(); } diff --git a/src/Factory/CycleDynamicFactory.php b/src/Factory/CycleDynamicFactory.php index e939dcba..4e0d3b77 100644 --- a/src/Factory/CycleDynamicFactory.php +++ b/src/Factory/CycleDynamicFactory.php @@ -9,7 +9,7 @@ final class CycleDynamicFactory implements FactoryInterface { - public function __construct(private Injector $injector) + public function __construct(private readonly Injector $injector) { } diff --git a/src/Factory/DbalFactory.php b/src/Factory/DbalFactory.php index e3e97278..69aa5f5a 100644 --- a/src/Factory/DbalFactory.php +++ b/src/Factory/DbalFactory.php @@ -14,7 +14,7 @@ final class DbalFactory { - private array|DatabaseConfig $dbalConfig; + private readonly array|DatabaseConfig $dbalConfig; /** @var LoggerInterface|string|null */ private mixed $logger = null; diff --git a/src/Factory/RepositoryContainer.php b/src/Factory/RepositoryContainer.php index f3e3b5c3..35a46f47 100644 --- a/src/Factory/RepositoryContainer.php +++ b/src/Factory/RepositoryContainer.php @@ -15,7 +15,7 @@ final class RepositoryContainer implements ContainerInterface { - private ORMInterface $orm; + private readonly ORMInterface $orm; private bool $rolesBuilt = false; private array $roles = []; diff --git a/src/Listener/MigrationListener.php b/src/Listener/MigrationListener.php index 761df8fb..fbb6e1ae 100644 --- a/src/Listener/MigrationListener.php +++ b/src/Listener/MigrationListener.php @@ -10,7 +10,7 @@ final class MigrationListener { public function __construct( - private SchemaProviderInterface $schemaProvider, + private readonly SchemaProviderInterface $schemaProvider, ) { } diff --git a/tests/Feature/Schema/Conveyor/Stub/FakeGenerator.php b/tests/Feature/Schema/Conveyor/Stub/FakeGenerator.php index 52c3593f..9dce6391 100644 --- a/tests/Feature/Schema/Conveyor/Stub/FakeGenerator.php +++ b/tests/Feature/Schema/Conveyor/Stub/FakeGenerator.php @@ -9,7 +9,7 @@ class FakeGenerator implements GeneratorInterface { - public function __construct(private string $originClass) + public function __construct(private readonly string $originClass) { } From 734752ef4b3165cd2d0d3373139f9526bc9635fc Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 13 Mar 2024 12:30:48 +0500 Subject: [PATCH 23/24] Change rules for CI, BC (review fix) --- .github/workflows/bc.yml_ | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bc.yml_ b/.github/workflows/bc.yml_ index 6b506228..2197bd4b 100644 --- a/.github/workflows/bc.yml_ +++ b/.github/workflows/bc.yml_ @@ -1,6 +1,27 @@ on: - - pull_request - - push + pull_request: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'phpunit.xml.dist' + - 'psalm.xml' + + push: + branches: ['master'] + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'phpunit.xml.dist' + - 'infection.json.dist' + - 'phpunit.xml.dist' + - 'psalm.xml' name: backwards compatibility From 9c9dd41d8e4eb48b502e233ee43a9ca5cc0558ec Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 13 Mar 2024 12:35:42 +0500 Subject: [PATCH 24/24] Drop 4 version of Psalm --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ebe49884..aadaeabe 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "rector/rector": "^1.0", "roave/infection-static-analysis-plugin": "^1.25", "spatie/phpunit-watcher": "^1.23", - "vimeo/psalm": "^4.30|^5.7", + "vimeo/psalm": "^5.7", "yiisoft/definitions": "^3.2", "yiisoft/di": "^1.2", "yiisoft/test-support": "^3.0"