Skip to content

Commit

Permalink
Merge pull request #37 from redthor/fix/cleanup-scrutinizer-issues
Browse files Browse the repository at this point in the history
Fix/cleanup scrutinizer issues
  • Loading branch information
redthor authored May 6, 2018
2 parents 7ef62d6 + cc4367e commit 0607e7e
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 62 deletions.
10 changes: 5 additions & 5 deletions src/AntiMattr/MongoDB/Migrations/AbstractMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
abstract class AbstractMigration
{
/**
* @var AntiMattr\MongoDB\Migrations\Configuration\Configuration
* @var \AntiMattr\MongoDB\Migrations\Configuration\Configuration
*/
private $configuration;

/**
* @var AntiMattr\MongoDB\Migrations\OutputWriter
* @var \AntiMattr\MongoDB\Migrations\OutputWriter
*/
private $outputWriter;

/**
* @var AntiMattr\MongoDB\Migrations\Version
* @var \AntiMattr\MongoDB\Migrations\Version
*/
protected $version;

Expand All @@ -56,15 +56,15 @@ abstract public function up(Database $db);
abstract public function down(Database $db);

/**
* @param Doctrine\MongoDB\Collection
* @param \Doctrine\MongoDB\Collection
*/
protected function analyze(Collection $collection)
{
$this->version->analyze($collection);
}

/**
* @param Doctrine\MongoDB\Database
* @param \Doctrine\MongoDB\Database
* @param string $filename
*/
protected function executeScript(Database $db, $filename)
Expand Down
6 changes: 3 additions & 3 deletions src/AntiMattr/MongoDB/Migrations/Collection/Statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Statistics
];

/**
* @var Doctrine\MongoDB\Collection
* @var \Doctrine\MongoDB\Collection
*/
private $collection;

Expand All @@ -57,15 +57,15 @@ class Statistics
private $after = [];

/**
* @param Doctrine\MongoDB\Collection
* @param \Doctrine\MongoDB\Collection
*/
public function setCollection(Collection $collection)
{
$this->collection = $collection;
}

/**
* @return Doctrine\MongoDB\Collection
* @return \Doctrine\MongoDB\Collection
*/
public function getCollection()
{
Expand Down
38 changes: 19 additions & 19 deletions src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@
class Configuration
{
/**
* @var Doctrine\MongoDB\Collection
* @var \Doctrine\MongoDB\Collection
*/
private $collection;

/**
* @var Doctrine\MongoDB\Connection
* @var \Doctrine\MongoDB\Connection
*/
private $connection;

/**
* @var Doctrine\MongoDB\Database
* @var \Doctrine\MongoDB\Database
*/
private $database;

/**
* @var Doctrine\MongoDB\Connection
* @var \Doctrine\MongoDB\Connection
*/
private $migrationsDatabase;

Expand Down Expand Up @@ -94,18 +94,18 @@ class Configuration
private $name;

/**
* @var AntiMattr\MongoDB\Migrations\Version[]
* @var \AntiMattr\MongoDB\Migrations\Version[]
*/
protected $migrations = [];

/**
* @var AntiMattr\MongoDB\Migrations\OutputWriter
* @var \AntiMattr\MongoDB\Migrations\OutputWriter
*/
private $outputWriter;

/**
* @param Doctrine\MongoDB\Connection $connection
* @param AntiMattr\MongoDB\Migrations\OutputWriter $outputWriter
* @param \Doctrine\MongoDB\Connection $connection
* @param \AntiMattr\MongoDB\Migrations\OutputWriter $outputWriter
*/
public function __construct(Connection $connection, OutputWriter $outputWriter = null)
{
Expand Down Expand Up @@ -151,7 +151,7 @@ public function getAvailableVersions()
}

/**
* @return Doctrine\MongoDB\Collection
* @return \Doctrine\MongoDB\Collection
*/
public function getCollection()
{
Expand All @@ -165,15 +165,15 @@ public function getCollection()
}

/**
* @return Doctrine\MongoDB\Connection
* @return \Doctrine\MongoDB\Connection
*/
public function getConnection()
{
return $this->connection;
}

/**
* @return Doctrine\MongoDB\Database
* @return \Doctrine\MongoDB\Database
*/
public function getDatabase(): ?Database
{
Expand Down Expand Up @@ -281,7 +281,7 @@ public function getMigrationsScriptDirectory()
/**
* Returns all migrated versions from the versions collection, in an array.
*
* @return AntiMattr\MongoDB\Migrations\Version[]
* @return \AntiMattr\MongoDB\Migrations\Version[]
*/
public function getMigratedVersions()
{
Expand All @@ -301,12 +301,12 @@ public function getMigratedVersions()
*
* @param string $version
*
* @return string
* @return int
*
* @throws AntiMattr\MongoDB\Migrations\Exception\UnknownVersionException Throws exception if migration version does not exist
* @throws DomainException If more than one version exists
*/
public function getMigratedTimestamp($version)
public function getMigratedTimestamp($version): int
{
$this->createMigrationCollection();

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

return (string) $ts;
return $ts->getTimestamp();
}

/**
Expand Down Expand Up @@ -379,7 +379,7 @@ public function getNumberOfExecutedMigrations()
}

/**
* @return AntiMattr\MongoDB\Migrations\OutputWriter
* @return \AntiMattr\MongoDB\Migrations\OutputWriter
*/
public function getOutputWriter()
{
Expand Down Expand Up @@ -468,7 +468,7 @@ public function registerMigrationsFromDirectory($path)
*
* @param string $version The version string in the format YYYYMMDDHHMMSS
*
* @return AntiMattr\MongoDB\Migrations\Version
* @return \AntiMattr\MongoDB\Migrations\Version
*
* @throws AntiMattr\MongoDB\Migrations\Exception\UnknownVersionException Throws exception if migration version does not exist
*/
Expand Down Expand Up @@ -496,7 +496,7 @@ public function hasVersion($version)
/**
* Check if a version has been migrated or not yet.
*
* @param AntiMattr\MongoDB\Migrations\Version $version
* @param \AntiMattr\MongoDB\Migrations\Version $version
*
* @return bool
*/
Expand All @@ -517,7 +517,7 @@ public function getCurrentVersion()
$this->createMigrationCollection();

$migratedVersions = [];
if ($this->migrations) {
if (!empty($this->migrations)) {
foreach ($this->migrations as $migration) {
$migratedVersions[] = $migration->getVersion();
}
Expand Down
2 changes: 1 addition & 1 deletion src/AntiMattr/MongoDB/Migrations/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function migrate($to = null)

$time = 0;
foreach ($migrationsToExecute as $version) {
$versionSql = $version->execute($direction);
$version->execute($direction);
$time += $version->getTime();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
abstract class AbstractCommand extends Command
{
/**
* @var AntiMattr\MongoDB\Migrations\Configuration\Configuration
* @var \AntiMattr\MongoDB\Migrations\Configuration\Configuration
*/
private $configuration;

Expand All @@ -43,8 +43,8 @@ protected function configure()
}

/**
* @param AntiMattr\MongoDB\Migrations\Configuration\Configuration
* @param Symfony\Component\Console\Output\OutputInterface
* @param \AntiMattr\MongoDB\Migrations\Configuration\Configuration $configuration
* @param \Symfony\Component\Console\Output\OutputInterface $output
*/
protected function outputHeader(Configuration $configuration, OutputInterface $output)
{
Expand All @@ -58,18 +58,18 @@ protected function outputHeader(Configuration $configuration, OutputInterface $o
}

/**
* @param AntiMattr\MongoDB\Migrations\Configuration\Configuration
* @param \AntiMattr\MongoDB\Migrations\Configuration\Configuration
*/
public function setMigrationConfiguration(Configuration $config)
{
$this->configuration = $config;
}

/**
* @param Symfony\Component\Console\Output\InputInterface $input
* @param Symfony\Component\Console\Output\OutputInterface $output
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*
* @return AntiMattr\MongoDB\Migrations\Configuration\Configuration
* @return \AntiMattr\MongoDB\Migrations\Configuration\Configuration
*/
protected function getMigrationConfiguration(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -112,9 +112,9 @@ protected function getMigrationConfiguration(InputInterface $input, OutputInterf
}

/**
* @params array $params
* @param array $params
*
* @return Doctrine\MongoDB\Connection
* @return \Doctrine\MongoDB\Connection
*/
protected function createConnection($params)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ protected function configure()
}

/**
* @param Symfony\Component\Console\Input\InputInterface
* @param Symfony\Component\Console\Output\OutputInterface
* @param \Symfony\Component\Console\Input\InputInterface
* @param \Symfony\Component\Console\Output\OutputInterface
*/
public function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ protected function configure()
}

/**
* @param Symfony\Component\Console\Input\InputInterface
* @param Symfony\Component\Console\Output\OutputInterface
* @param \Symfony\Component\Console\Input\InputInterface
* @param \Symfony\Component\Console\Output\OutputInterface
*/
public function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -93,8 +93,8 @@ public function execute(InputInterface $input, OutputInterface $output)
}

/**
* @param AntiMattr\MongoDB\Migrations\Configuration\Configuration
* @param Symfony\Component\Console\Input\InputInterface
* @param \AntiMattr\MongoDB\Migrations\Configuration\Configuration
* @param \Symfony\Component\Console\Input\InputInterface
* @param string $version
* @param string $up
* @param string $down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ protected function configure()
}

/**
* @param Symfony\Component\Console\Input\InputInterface
* @param Symfony\Component\Console\Output\OutputInterface
* @param \Symfony\Component\Console\Input\InputInterface
* @param \Symfony\Component\Console\Output\OutputInterface
*/
public function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ protected function configure()
}

/**
* @param Symfony\Component\Console\Input\InputInterface
* @param Symfony\Component\Console\Output\OutputInterface
* @param \Symfony\Component\Console\Input\InputInterface
* @param \Symfony\Component\Console\Output\OutputInterface
*/
public function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -146,7 +146,7 @@ public function execute(InputInterface $input, OutputInterface $output)
}

$executedUnavailableMigrations = $configuration->getUnavailableMigratedVersions();
if ($executedUnavailableMigrations) {
if (!empty($executedUnavailableMigrations)) {
$output->writeln("\n <info>==</info> Previously Executed Unavailable Migration Versions\n");
foreach ($executedUnavailableMigrations as $executedUnavailableMigration) {
$output->writeln(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ protected function configure()
}

/**
* @param Symfony\Component\Console\Input\InputInterface
* @param Symfony\Component\Console\Output\OutputInterface
* @param \Symfony\Component\Console\Input\InputInterface
* @param \Symfony\Component\Console\Output\OutputInterface
*
* @throws AntiMattr\MongoDB\Migrations\Exception\UnknownVersionException Throws exception if migration version does not exist
* @throws InvalidArgumentException
Expand Down
Loading

0 comments on commit 0607e7e

Please sign in to comment.