diff --git a/apps/dav/lib/Migration/Version1025Date20240308063933.php b/apps/dav/lib/Migration/Version1025Date20240308063933.php index 83a0b46a23e..37217918679 100644 --- a/apps/dav/lib/Migration/Version1025Date20240308063933.php +++ b/apps/dav/lib/Migration/Version1025Date20240308063933.php @@ -17,21 +17,17 @@ use OCP\DB\Types; use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; class Version1025Date20240308063933 extends SimpleMigrationStep { public function __construct( - private IAppConfig $appConfig, - private IDBConnection $db, + private readonly IAppConfig $appConfig, + private readonly IDBConnection $db, ) { } - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -50,6 +46,7 @@ class Version1025Date20240308063933 extends SimpleMigrationStep { return $schema; } + #[Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { // The threshold is higher than the default of \OCA\DAV\BackgroundJob\PruneOutdatedSyncTokensJob // but small enough to fit into a cluster transaction size. diff --git a/apps/dav/lib/Migration/Version1027Date20230504122946.php b/apps/dav/lib/Migration/Version1027Date20230504122946.php index 89c192a8419..af23dbd052f 100644 --- a/apps/dav/lib/Migration/Version1027Date20230504122946.php +++ b/apps/dav/lib/Migration/Version1027Date20230504122946.php @@ -11,11 +11,11 @@ namespace OCA\DAV\Migration; use Closure; use OCA\DAV\CardDAV\SyncService; -use OCP\DB\ISchemaWrapper; use OCP\IConfig; use OCP\IUserManager; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; use Psr\Log\LoggerInterface; use Throwable; @@ -27,11 +27,8 @@ class Version1027Date20230504122946 extends SimpleMigrationStep { private IConfig $config, ) { } - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - */ + + #[Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { if ($this->userManager->countSeenUsers() > 100 || $this->userManager->countUsersTotal(100) >= 100) { $this->config->setAppValue('dav', 'needs_system_address_book_sync', 'yes'); diff --git a/apps/dav/lib/Migration/Version1029Date20231004091403.php b/apps/dav/lib/Migration/Version1029Date20231004091403.php index 1dcbf9c5dfc..f34eae6f1e8 100644 --- a/apps/dav/lib/Migration/Version1029Date20231004091403.php +++ b/apps/dav/lib/Migration/Version1029Date20231004091403.php @@ -12,16 +12,14 @@ namespace OCA\DAV\Migration; use Closure; use OCP\DB\ISchemaWrapper; use OCP\DB\Types; +use OCP\Migration\Attributes\CreateTable; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; +#[CreateTable(table: 'dav_absence')] class Version1029Date20231004091403 extends SimpleMigrationStep { - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1030Date20240205103243.php b/apps/dav/lib/Migration/Version1030Date20240205103243.php index 72cbcafc444..1fb1e54e772 100644 --- a/apps/dav/lib/Migration/Version1030Date20240205103243.php +++ b/apps/dav/lib/Migration/Version1030Date20240205103243.php @@ -11,17 +11,14 @@ namespace OCA\DAV\Migration; use Closure; use OCP\DB\ISchemaWrapper; +use OCP\Migration\Attributes\DropIndex; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; +#[DropIndex(table: 'cards')] class Version1030Date20240205103243 extends SimpleMigrationStep { - - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1034Date20250605132605.php b/apps/dav/lib/Migration/Version1034Date20250605132605.php index 2eff120c393..9bb7f4fe718 100644 --- a/apps/dav/lib/Migration/Version1034Date20250605132605.php +++ b/apps/dav/lib/Migration/Version1034Date20250605132605.php @@ -17,16 +17,12 @@ use OCP\Migration\Attributes\ColumnType; use OCP\Migration\Attributes\CreateTable; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; #[AddColumn(table: 'dav_shares', name: 'token', type: ColumnType::STRING)] #[CreateTable(table: 'calendars_federated', columns: ['id', 'display_name', 'color', 'uri', 'principaluri', 'remote_Url', 'token', 'sync_token', 'last_sync', 'shared_by', 'shared_by_display_name', 'components', 'permissions'], description: 'Supporting Federated Calender')] class Version1034Date20250605132605 extends SimpleMigrationStep { - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/dav/lib/Migration/Version1034Date20250813093701.php b/apps/dav/lib/Migration/Version1034Date20250813093701.php index e3571781042..e3670ffbc8f 100644 --- a/apps/dav/lib/Migration/Version1034Date20250813093701.php +++ b/apps/dav/lib/Migration/Version1034Date20250813093701.php @@ -10,7 +10,6 @@ declare(strict_types=1); namespace OCA\DAV\Migration; use Closure; -use OCP\DB\ISchemaWrapper; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\Migration\Attributes\DataCleansing; @@ -25,11 +24,6 @@ class Version1034Date20250813093701 extends SimpleMigrationStep { ) { } - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - */ #[Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $qb = $this->db->getQueryBuilder(); diff --git a/apps/dav/lib/Migration/Version1036Date20251202000000.php b/apps/dav/lib/Migration/Version1036Date20251202000000.php index 745a9a01905..39c03d7d154 100644 --- a/apps/dav/lib/Migration/Version1036Date20251202000000.php +++ b/apps/dav/lib/Migration/Version1036Date20251202000000.php @@ -21,9 +21,6 @@ use Override; #[ModifyColumn(table: 'calendar_reminders', name: 'uid', type: ColumnType::STRING, description: 'Increase uid length to 512 characters')] #[ModifyColumn(table: 'calendar_invitations', name: 'uid', type: ColumnType::STRING, description: 'Increase uid length to 512 characters')] class Version1036Date20251202000000 extends SimpleMigrationStep { - /** - * @param Closure(): ISchemaWrapper $schemaClosure - */ #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ diff --git a/apps/files/lib/Migration/Version2003Date20241021095629.php b/apps/files/lib/Migration/Version2003Date20241021095629.php index 30d05fa12ad..7d40acb90fd 100644 --- a/apps/files/lib/Migration/Version2003Date20241021095629.php +++ b/apps/files/lib/Migration/Version2003Date20241021095629.php @@ -11,26 +11,26 @@ namespace OCA\Files\Migration; use Closure; use OCA\Files\Service\ChunkedUploadConfig; -use OCP\DB\ISchemaWrapper; -use OCP\IConfig; +use OCP\IAppConfig; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; -use OCP\Server; +use Override; class Version2003Date20241021095629 extends SimpleMigrationStep { - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - */ + public function __construct( + public readonly IAppConfig $appConfig, + ) { + } + + #[Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { - $maxChunkSize = Server::get(IConfig::class)->getAppValue('files', 'max_chunk_size'); - if ($maxChunkSize === '') { + $maxChunkSize = $this->appConfig->getValueInt('files', 'max_chunk_size'); + if ($maxChunkSize === 0) { // Skip if no value was configured before return; } - ChunkedUploadConfig::setMaxChunkSize((int)$maxChunkSize); - Server::get(IConfig::class)->deleteAppValue('files', 'max_chunk_size'); + ChunkedUploadConfig::setMaxChunkSize($maxChunkSize); + $this->appConfig->deleteKey('files', 'max_chunk_size'); } } diff --git a/apps/files_external/lib/Migration/Version1025Date20250228162604.php b/apps/files_external/lib/Migration/Version1025Date20250228162604.php index f3d76ed7baa..ec70dac8c10 100644 --- a/apps/files_external/lib/Migration/Version1025Date20250228162604.php +++ b/apps/files_external/lib/Migration/Version1025Date20250228162604.php @@ -11,10 +11,9 @@ namespace OCA\Files_External\Migration; use Closure; use OCA\Files_External\Service\GlobalStoragesService; -use OCP\DB\ISchemaWrapper; -use OCP\IAppConfig; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; /** * Check for any external storage overwriting the home folder @@ -22,13 +21,10 @@ use OCP\Migration\SimpleMigrationStep; class Version1025Date20250228162604 extends SimpleMigrationStep { public function __construct( private GlobalStoragesService $globalStoragesServices, - private IAppConfig $appConfig, ) { } - /** - * @param Closure(): ISchemaWrapper $schemaClosure - */ + #[Override] public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $this->globalStoragesServices->updateOverwriteHomeFolders(); } diff --git a/apps/files_sharing/lib/Migration/Version31000Date20240821142813.php b/apps/files_sharing/lib/Migration/Version31000Date20240821142813.php index 71b2c1817e6..509936531f7 100644 --- a/apps/files_sharing/lib/Migration/Version31000Date20240821142813.php +++ b/apps/files_sharing/lib/Migration/Version31000Date20240821142813.php @@ -16,17 +16,13 @@ use OCP\Migration\Attributes\AddColumn; use OCP\Migration\Attributes\ColumnType; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; #[AddColumn(table: 'share', name: 'reminder_sent', type: ColumnType::BOOLEAN)] class Version31000Date20240821142813 extends SimpleMigrationStep { - - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); $table = $schema->getTable('share'); if ($table->hasColumn('reminder_sent')) { diff --git a/apps/files_trashbin/lib/Migration/Version1020Date20240403003535.php b/apps/files_trashbin/lib/Migration/Version1020Date20240403003535.php index 3e85edf40b6..6a2988fdf1d 100644 --- a/apps/files_trashbin/lib/Migration/Version1020Date20240403003535.php +++ b/apps/files_trashbin/lib/Migration/Version1020Date20240403003535.php @@ -16,13 +16,11 @@ use OCP\Migration\Attributes\AddColumn; use OCP\Migration\Attributes\ColumnType; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; #[AddColumn(table: 'files_trash', name: 'deleted_by', type: ColumnType::STRING)] class Version1020Date20240403003535 extends SimpleMigrationStep { - - /** - * @param Closure(): ISchemaWrapper $schemaClosure - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/webhook_listeners/lib/Migration/Version1000Date20240527153425.php b/apps/webhook_listeners/lib/Migration/Version1000Date20240527153425.php index ca8e708040c..4f6bd13372f 100644 --- a/apps/webhook_listeners/lib/Migration/Version1000Date20240527153425.php +++ b/apps/webhook_listeners/lib/Migration/Version1000Date20240527153425.php @@ -15,11 +15,10 @@ use OCP\DB\ISchemaWrapper; use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; class Version1000Date20240527153425 extends SimpleMigrationStep { - /** - * @param Closure(): ISchemaWrapper $schemaClosure - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/apps/webhook_listeners/lib/Migration/Version1001Date20240716184935.php b/apps/webhook_listeners/lib/Migration/Version1001Date20240716184935.php index 58c3ce6c181..fd4f2226fb6 100644 --- a/apps/webhook_listeners/lib/Migration/Version1001Date20240716184935.php +++ b/apps/webhook_listeners/lib/Migration/Version1001Date20240716184935.php @@ -14,16 +14,12 @@ use OCA\WebhookListeners\Db\WebhookListenerMapper; use OCP\DB\ISchemaWrapper; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; class Version1001Date20240716184935 extends SimpleMigrationStep { - - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); if ($schema->hasTable(WebhookListenerMapper::TABLE_NAME)) { diff --git a/apps/webhook_listeners/lib/Migration/Version1500Date20251007130000.php b/apps/webhook_listeners/lib/Migration/Version1500Date20251007130000.php index 4ca578da989..427e82d44cf 100644 --- a/apps/webhook_listeners/lib/Migration/Version1500Date20251007130000.php +++ b/apps/webhook_listeners/lib/Migration/Version1500Date20251007130000.php @@ -16,15 +16,10 @@ use OCP\DB\ISchemaWrapper; use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; class Version1500Date20251007130000 extends SimpleMigrationStep { - - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { $schema = $schemaClosure(); $schemaHasChanged = false; diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 634b83f8731..9243b71bc5d 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -1303,12 +1303,6 @@ - - - - - - getUID())]]> @@ -3518,7 +3512,6 @@ - diff --git a/core/Command/Db/ExpectedSchema.php b/core/Command/Db/ExpectedSchema.php index e8635b1117d..8c942a023a7 100644 --- a/core/Command/Db/ExpectedSchema.php +++ b/core/Command/Db/ExpectedSchema.php @@ -14,6 +14,7 @@ use OC\DB\Connection; use OC\DB\MigrationService; use OC\DB\SchemaWrapper; use OC\Migration\NullOutput; +use Override; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -21,11 +22,12 @@ use Symfony\Component\Console\Output\OutputInterface; class ExpectedSchema extends Base { public function __construct( - protected Connection $connection, + protected readonly Connection $connection, ) { parent::__construct(); } + #[Override] protected function configure(): void { $this ->setName('db:schema:expected') @@ -36,6 +38,7 @@ class ExpectedSchema extends Base { parent::configure(); } + #[Override] protected function execute(InputInterface $input, OutputInterface $output): int { $schema = new Schema(); $onlyTable = $input->getArgument('table'); diff --git a/core/Migrations/Version29000Date20231213104850.php b/core/Migrations/Version29000Date20231213104850.php index 41f0594a33e..cbbb7696346 100644 --- a/core/Migrations/Version29000Date20231213104850.php +++ b/core/Migrations/Version29000Date20231213104850.php @@ -14,14 +14,10 @@ use OCP\DB\ISchemaWrapper; use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; class Version29000Date20231213104850 extends SimpleMigrationStep { - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version29000Date20240131122720.php b/core/Migrations/Version29000Date20240131122720.php index abd5e73165a..7be514ec094 100644 --- a/core/Migrations/Version29000Date20240131122720.php +++ b/core/Migrations/Version29000Date20240131122720.php @@ -11,18 +11,14 @@ use Closure; use OCP\DB\ISchemaWrapper; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; /** * */ class Version29000Date20240131122720 extends SimpleMigrationStep { - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version30000Date20240906095113.php b/core/Migrations/Version30000Date20240906095113.php index 7c3efe41bc3..2aff4f914d6 100644 --- a/core/Migrations/Version30000Date20240906095113.php +++ b/core/Migrations/Version30000Date20240906095113.php @@ -14,16 +14,12 @@ use OCP\DB\ISchemaWrapper; use OCP\Migration\Attributes\ModifyColumn; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; #[ModifyColumn(table: 'taskprocessing_tasks', name: 'error_message', description: 'Increase column length to 4000 bytes to support longer error messages')] class Version30000Date20240906095113 extends SimpleMigrationStep { - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version32000Date20250731062008.php b/core/Migrations/Version32000Date20250731062008.php index 3068c47caa1..a2401d7a584 100644 --- a/core/Migrations/Version32000Date20250731062008.php +++ b/core/Migrations/Version32000Date20250731062008.php @@ -10,7 +10,6 @@ declare(strict_types=1); namespace OC\Core\Migrations; use Closure; -use OCP\DB\ISchemaWrapper; use OCP\IDBConnection; use OCP\Migration\Attributes\DataCleansing; use OCP\Migration\IOutput; @@ -26,15 +25,10 @@ use Override; #[DataCleansing(table: 'vcategory_to_object', description: 'Update object references')] class Version32000Date20250731062008 extends SimpleMigrationStep { public function __construct( - private IDBConnection $connection, + private readonly IDBConnection $connection, ) { } - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - */ #[Override] public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { // Clean up duplicate categories before adding unique constraint diff --git a/core/Migrations/Version33000Date20250819110529.php b/core/Migrations/Version33000Date20250819110529.php index 32a25b0e33c..570a2ee72d4 100644 --- a/core/Migrations/Version33000Date20250819110529.php +++ b/core/Migrations/Version33000Date20250819110529.php @@ -14,6 +14,7 @@ use OCP\DB\Types; use OCP\Migration\Attributes\CreateTable; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; /** * @@ -22,9 +23,7 @@ use OCP\Migration\SimpleMigrationStep; #[CreateTable(table: 'preview_locations', description: 'Holds the preview location in an object store')] class Version33000Date20250819110529 extends SimpleMigrationStep { - /** - * @param Closure(): ISchemaWrapper $schemaClosure The `\Closure` returns a `ISchemaWrapper` - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version33000Date20251023110529.php b/core/Migrations/Version33000Date20251023110529.php index d87e8bc1f0b..26204088a64 100644 --- a/core/Migrations/Version33000Date20251023110529.php +++ b/core/Migrations/Version33000Date20251023110529.php @@ -13,6 +13,7 @@ use OCP\DB\ISchemaWrapper; use OCP\Migration\Attributes\ModifyColumn; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; +use Override; /** * Migrate away from auto-increment @@ -21,9 +22,7 @@ use OCP\Migration\SimpleMigrationStep; #[ModifyColumn(table: 'previews', name: 'id', description: 'Remove auto-increment')] #[ModifyColumn(table: 'preview_versions', name: 'id', description: 'Remove auto-increment')] class Version33000Date20251023110529 extends SimpleMigrationStep { - /** - * @param Closure(): ISchemaWrapper $schemaClosure The `\Closure` returns a `ISchemaWrapper` - */ + #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { $schema = $schemaClosure(); diff --git a/core/Migrations/Version33000Date20251023120529.php b/core/Migrations/Version33000Date20251023120529.php index 5c04b394208..1cecb655181 100644 --- a/core/Migrations/Version33000Date20251023120529.php +++ b/core/Migrations/Version33000Date20251023120529.php @@ -26,9 +26,7 @@ class Version33000Date20251023120529 extends SimpleMigrationStep { ) { } - /** - * @param Closure(): ISchemaWrapper $schemaClosure The `\Closure` returns a `ISchemaWrapper` - */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -41,6 +39,7 @@ class Version33000Date20251023120529 extends SimpleMigrationStep { return $schema; } + #[\Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { // This shouldn't run on a production instance, only daily $qb = $this->connection->getQueryBuilder(); diff --git a/core/Migrations/Version33000Date20251124110529.php b/core/Migrations/Version33000Date20251124110529.php index a8adeb2313e..043367b17d9 100644 --- a/core/Migrations/Version33000Date20251124110529.php +++ b/core/Migrations/Version33000Date20251124110529.php @@ -17,9 +17,6 @@ use Override; #[ModifyColumn(table: 'jobs', name: 'id', description: 'Remove auto-increment')] class Version33000Date20251124110529 extends SimpleMigrationStep { - /** - * @param Closure(): ISchemaWrapper $schemaClosure The `\Closure` returns a `ISchemaWrapper` - */ #[Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { $schema = $schemaClosure(); diff --git a/lib/public/Migration/IMigrationStep.php b/lib/public/Migration/IMigrationStep.php index d738fee8e8d..584e2436318 100644 --- a/lib/public/Migration/IMigrationStep.php +++ b/lib/public/Migration/IMigrationStep.php @@ -11,13 +11,20 @@ use Closure; use OCP\DB\ISchemaWrapper; /** + * This interface represents a database migration step. + * + * To implement a migration step, you must extend \OCP\Migration\SimpleMigrationStep + * + * You should additionally add some attributes found in the + * \OCP\Migration\Attributes namespace to the migration, to describe the change + * that will be done by the migration step to the admin. + * * @since 13.0.0 */ interface IMigrationStep { /** * Human-readable name of the migration step * - * @return string * @since 14.0.0 */ public function name(): string; @@ -25,35 +32,28 @@ interface IMigrationStep { /** * Human-readable description of the migration step * - * @return string * @since 14.0.0 */ public function description(): string; /** - * @param IOutput $output - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @psalm-param Closure():ISchemaWrapper $schemaClosure - * @param array $options + * @param Closure():ISchemaWrapper $schemaClosure + * @param array{tablePrefix?: string} $options * @since 13.0.0 */ public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options); /** - * @param IOutput $output - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @psalm-param Closure():ISchemaWrapper $schemaClosure - * @param array $options + * @param Closure():ISchemaWrapper $schemaClosure + * @param array{tablePrefix?: string} $options * @return null|ISchemaWrapper * @since 13.0.0 */ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options); /** - * @param IOutput $output - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @psalm-param Closure():ISchemaWrapper $schemaClosure - * @param array $options + * @param Closure():ISchemaWrapper $schemaClosure + * @param array{tablePrefix?: string} $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 6119d533530..4f6f3770919 100644 --- a/lib/public/Migration/SimpleMigrationStep.php +++ b/lib/public/Migration/SimpleMigrationStep.php @@ -7,62 +7,34 @@ declare(strict_types=1); */ namespace OCP\Migration; -use Closure; -use OCP\DB\ISchemaWrapper; +use Override; /** + * Abstract class implementing migration step. + * * @since 13.0.0 */ abstract class SimpleMigrationStep implements IMigrationStep { - /** - * Human-readable name of the migration step - * - * @return string - * @since 14.0.0 - */ + #[Override] public function name(): string { return ''; } - /** - * Human-readable description of the migration step - * - * @return string - * @since 14.0.0 - */ + #[Override] public function description(): string { return ''; } - /** - * @param IOutput $output - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @psalm-param Closure():ISchemaWrapper $schemaClosure - * @param array $options - * @since 13.0.0 - */ + #[Override] public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { } - /** - * @param IOutput $output - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @psalm-param Closure():ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - * @since 13.0.0 - */ + #[Override] public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { return null; } - /** - * @param IOutput $output - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @psalm-param Closure():ISchemaWrapper $schemaClosure - * @param array $options - * @since 13.0.0 - */ + #[Override] public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { } }