Skip to content

Commit 18c0280

Browse files
committed
Apply scrutinizer recommendations, fix return type
1 parent 93ba9f6 commit 18c0280

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,12 @@ public function getMigratedVersions()
301301
*
302302
* @param string $version
303303
*
304-
* @return string
304+
* @return int
305305
*
306306
* @throws AntiMattr\MongoDB\Migrations\Exception\UnknownVersionException Throws exception if migration version does not exist
307307
* @throws DomainException If more than one version exists
308308
*/
309-
public function getMigratedTimestamp($version)
309+
public function getMigratedTimestamp($version): int
310310
{
311311
$this->createMigrationCollection();
312312

@@ -329,7 +329,7 @@ public function getMigratedTimestamp($version)
329329
// Convert to normalised timestamp
330330
$ts = new Timestamp($returnVersion['t']);
331331

332-
return (string) $ts;
332+
return $ts->getTimestamp();
333333
}
334334

335335
/**
@@ -517,7 +517,7 @@ public function getCurrentVersion()
517517
$this->createMigrationCollection();
518518

519519
$migratedVersions = [];
520-
if ($this->migrations) {
520+
if (!empty($this->migrations)) {
521521
foreach ($this->migrations as $migration) {
522522
$migratedVersions[] = $migration->getVersion();
523523
}

src/AntiMattr/MongoDB/Migrations/Tools/Console/Command/AbstractCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function setMigrationConfiguration(Configuration $config)
6666
}
6767

6868
/**
69-
* @param \Symfony\Component\Console\Output\InputInterface $input
69+
* @param \Symfony\Component\Console\Input\InputInterface $input
7070
* @param \Symfony\Component\Console\Output\OutputInterface $output
7171
*
7272
* @return \AntiMattr\MongoDB\Migrations\Configuration\Configuration

src/AntiMattr/MongoDB/Migrations/Tools/Console/Command/StatusCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function execute(InputInterface $input, OutputInterface $output)
146146
}
147147

148148
$executedUnavailableMigrations = $configuration->getUnavailableMigratedVersions();
149-
if ($executedUnavailableMigrations) {
149+
if (!empty($executedUnavailableMigrations)) {
150150
$output->writeln("\n <info>==</info> Previously Executed Unavailable Migration Versions\n");
151151
foreach ($executedUnavailableMigrations as $executedUnavailableMigration) {
152152
$output->writeln(

0 commit comments

Comments
 (0)