Skip to content

Commit

Permalink
Code style fix (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkomarev authored Mar 10, 2024
1 parent a061b17 commit a899212
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
8 changes: 4 additions & 4 deletions src/ClickhouseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static function (Application $app): ClickhouseClient {
$clickhouseClientFactory = new ClickhouseClientFactory($connectionConfig);

return $clickhouseClientFactory->create();
}
},
);

$this->app->singleton(
Expand All @@ -61,7 +61,7 @@ static function (Application $app): Migrator {
$repository,
$filesystem,
);
}
},
);

$this->app->singleton(
Expand All @@ -71,7 +71,7 @@ static function (Application $app): MigrationCreator {
$app->get(Filesystem::class),
$app->basePath('stubs'),
);
}
},
);
}

Expand Down Expand Up @@ -99,7 +99,7 @@ private function registerConsoleCommands(): void
[
ClickhouseMigrateCommand::class,
MakeClickhouseMigrationCommand::class,
]
],
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ConsoleCommand/MakeClickhouseMigrationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private function getMigrationPath(): string

return rtrim(
$this->appConfigRepository->get('clickhouse.migrations.path'),
'/'
'/',
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Migration/AbstractClickhouseMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

abstract class AbstractClickhouseMigration
{
protected ?Client $clickhouseClient;
protected Client $clickhouseClient;
protected string $databaseName;

public function __construct(
Expand Down
19 changes: 8 additions & 11 deletions src/Migration/MigrationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function createMigrationRegistryTable(): Statement
SQL,
[
'table' => $this->table,
]
],
);
}

Expand All @@ -62,7 +62,7 @@ public function all(): array
SQL,
[
'table' => $this->table,
]
],
)->rows();

return collect($rows)->pluck('migration')->all();
Expand All @@ -83,7 +83,7 @@ public function latest(): array
SQL,
[
'table' => $this->table,
]
],
)->rows();

return collect($rows)->pluck('migration')->all();
Expand All @@ -104,7 +104,7 @@ public function getLastBatchNumber(): int
SQL,
[
'table' => $this->table,
]
],
)
->fetchOne('batch');
}
Expand All @@ -116,13 +116,10 @@ public function add(
return $this->client->insert(
$this->table,
[[$migration, $batch]],
['migration', 'batch']
['migration', 'batch'],
);
}

/**
* @return int
*/
public function total(): int
{
return (int)$this->client->select(
Expand All @@ -132,7 +129,7 @@ public function total(): int
SQL,
[
'table' => $this->table,
]
],
)->fetchOne('count');
}

Expand All @@ -144,7 +141,7 @@ public function exists(): bool
SQL,
[
'table' => $this->table,
]
],
)->fetchOne('result');
}

Expand All @@ -165,7 +162,7 @@ public function find(
[
'table' => $this->table,
'migration' => $migration,
]
],
)->fetchOne();
}
}
12 changes: 6 additions & 6 deletions src/Migration/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function runUp(

if ($migrations->valid() === false) {
$output->writeln(
'<info>Migrations are empty.</info>'
'<info>Migrations are empty.</info>',
);

return;
Expand All @@ -76,7 +76,7 @@ public function runUp(
$this->repository->add($migrationName, $nextBatch);

$output->writeln(
"<info>Completed in {$runTime} seconds</info> {$migrationName}"
"<info>Completed in {$runTime} seconds</info> {$migrationName}",
);

$migrations->next();
Expand Down Expand Up @@ -109,7 +109,7 @@ private function getMigrationName(
}

/**
* @return SplFileInfo[]
* @return list<SplFileInfo>
*/
private function getUnAppliedMigrationFiles(
string $migrationsDirectoryPath
Expand All @@ -120,7 +120,7 @@ private function getUnAppliedMigrationFiles(
->reject(
fn(SplFileInfo $migrationFile) => $this->isAppliedMigration(
$migrationFile->getFilename(),
)
),
)->all();
}

Expand All @@ -145,7 +145,7 @@ private function generateMigrationClassName(
string $migrationName
): string {
return Str::studly(
implode('_', array_slice(explode('_', $migrationName), 4))
implode('_', array_slice(explode('_', $migrationName), 4)),
);
}

Expand All @@ -167,7 +167,7 @@ private function isAppliedMigration(
return in_array(
$this->getMigrationName($fileName),
$this->repository->all(),
true
true,
);
}
}

0 comments on commit a899212

Please sign in to comment.