From 65897d2bd52b95d5623bce96348e6c8ae5f346e5 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 12 Oct 2022 19:26:11 +0200 Subject: [PATCH] fix imigration type hints Signed-off-by: Roeland Jago Douma --- core/Command/Db/Migrations/GenerateCommand.php | 16 ++++++++-------- .../Version25000Date20220602190540.php | 4 ++-- lib/public/Migration/BigIntMigration.php | 9 ++++----- lib/public/Migration/IMigrationStep.php | 7 +++++++ lib/public/Migration/SimpleMigrationStep.php | 9 ++++++--- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php index aa93adaebb4d5..2aa893bafde19 100644 --- a/core/Command/Db/Migrations/GenerateCommand.php +++ b/core/Command/Db/Migrations/GenerateCommand.php @@ -73,22 +73,21 @@ class GenerateCommand extends Command implements CompletionAwareInterface { use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; -/** - * Auto-generated migration step: Please modify to your needs! - */ class {{classname}} extends SimpleMigrationStep { /** * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure + * @param Closure $schemaClosure + * @psalm-param Closure(): ISchemaWrapper $schemaClosure * @param array $options */ - public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { + public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { } /** * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure + * @param Closure $schemaClosure + * @psalm-param Closure(): ISchemaWrapper $schemaClosure * @param array $options * @return null|ISchemaWrapper */ @@ -98,8 +97,9 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt /** * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure -g * @param array $options + * @param Closure $schemaClosure + * @psalm-param Closure(): ISchemaWrapper $schemaClosure + * @param array $options */ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { } diff --git a/core/Migrations/Version25000Date20220602190540.php b/core/Migrations/Version25000Date20220602190540.php index ba5345f2ae754..d5e2ffa15ec6b 100644 --- a/core/Migrations/Version25000Date20220602190540.php +++ b/core/Migrations/Version25000Date20220602190540.php @@ -35,12 +35,12 @@ class Version25000Date20220602190540 extends SimpleMigrationStep { /** * @param IOutput $output - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param Closure(): ISchemaWrapper $schemaClosure + * @psalm-param Closure $schemaClosure * @param array $options * @return null|ISchemaWrapper */ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { - /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); $comments = $schema->getTable('comments'); diff --git a/lib/public/Migration/BigIntMigration.php b/lib/public/Migration/BigIntMigration.php index a9782f1f2645a..46ea9d12220aa 100644 --- a/lib/public/Migration/BigIntMigration.php +++ b/lib/public/Migration/BigIntMigration.php @@ -23,6 +23,7 @@ */ namespace OCP\Migration; +use Closure; use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use OCP\DB\ISchemaWrapper; @@ -39,13 +40,11 @@ abstract class BigIntMigration extends SimpleMigrationStep { abstract protected function getColumnsByTable(); /** - * @param IOutput $output - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @param array $options - * @return null|ISchemaWrapper + * {@inheritDoc} + * * @since 13.0.0 */ - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/public/Migration/IMigrationStep.php b/lib/public/Migration/IMigrationStep.php index da9f62e861e4b..9b987ef66e9fd 100644 --- a/lib/public/Migration/IMigrationStep.php +++ b/lib/public/Migration/IMigrationStep.php @@ -43,7 +43,11 @@ interface IMigrationStep { public function name(): string; /** +<<<<<<< HEAD * Human-readable description of the migration step +======= + * Human-readable description of the migration steps +>>>>>>> acf9c4a0c68... fixup! fix imigration type hints * * @return string * @since 14.0.0 @@ -55,6 +59,7 @@ public function description(): string; * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @psalm-param Closure():ISchemaWrapper $schemaClosure * @param array $options + * * @since 13.0.0 */ public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options); @@ -65,6 +70,7 @@ public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $ * @psalm-param Closure():ISchemaWrapper $schemaClosure * @param array $options * @return null|ISchemaWrapper + * * @since 13.0.0 */ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options); @@ -74,6 +80,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @psalm-param Closure():ISchemaWrapper $schemaClosure * @param array $options + * * @since 13.0.0 */ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options); diff --git a/lib/public/Migration/SimpleMigrationStep.php b/lib/public/Migration/SimpleMigrationStep.php index ee657cda47021..22c0059e23a73 100644 --- a/lib/public/Migration/SimpleMigrationStep.php +++ b/lib/public/Migration/SimpleMigrationStep.php @@ -60,9 +60,10 @@ public function description(): string { * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @psalm-param Closure():ISchemaWrapper $schemaClosure * @param array $options + * * @since 13.0.0 */ - public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { + public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { } /** @@ -71,9 +72,10 @@ public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array * @psalm-param Closure():ISchemaWrapper $schemaClosure * @param array $options * @return null|ISchemaWrapper + * * @since 13.0.0 */ - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { return null; } @@ -82,8 +84,9 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @psalm-param Closure():ISchemaWrapper $schemaClosure * @param array $options + * * @since 13.0.0 */ - public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { } }