Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
typehint migrationservice closures
Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer committed Oct 9, 2022
commit d151999fc8f31f7c9e76e9aa07a0ca50a9d5bdd6
9 changes: 5 additions & 4 deletions lib/private/DB/MigrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use OC\Migration\SimpleOutput;
use OCP\AppFramework\App;
use OCP\AppFramework\QueryException;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IMigrationStep;
use OCP\Migration\IOutput;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -440,7 +441,7 @@ public function migrateSchemaOnly($to = 'latest') {
foreach ($toBeExecuted as $version) {
$instance = $this->createInstance($version);

$toSchema = $instance->changeSchema($this->output, function () use ($toSchema) {
$toSchema = $instance->changeSchema($this->output, function () use ($toSchema): ISchemaWrapper {
return $toSchema ?: new SchemaWrapper($this->connection);
}, ['tablePrefix' => $this->connection->getPrefix()]) ?: $toSchema;
}
Expand Down Expand Up @@ -513,12 +514,12 @@ public function executeStep($version, $schemaOnly = false) {
$instance = $this->createInstance($version);

if (!$schemaOnly) {
$instance->preSchemaChange($this->output, function () {
$instance->preSchemaChange($this->output, function (): ISchemaWrapper {
return new SchemaWrapper($this->connection);
}, ['tablePrefix' => $this->connection->getPrefix()]);
}

$toSchema = $instance->changeSchema($this->output, function () {
$toSchema = $instance->changeSchema($this->output, function (): ISchemaWrapper {
return new SchemaWrapper($this->connection);
}, ['tablePrefix' => $this->connection->getPrefix()]);

Expand All @@ -533,7 +534,7 @@ public function executeStep($version, $schemaOnly = false) {
}

if (!$schemaOnly) {
$instance->postSchemaChange($this->output, function () {
$instance->postSchemaChange($this->output, function (): ISchemaWrapper {
return new SchemaWrapper($this->connection);
}, ['tablePrefix' => $this->connection->getPrefix()]);
}
Expand Down