diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 8fe48c1d..3e399791 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -132,6 +132,11 @@ $executedVersion + + + ConfigurationTrait + + ConfigurationTrait diff --git a/src/Migration/Manager.php b/src/Migration/Manager.php index 9d39f9ec..475620cb 100644 --- a/src/Migration/Manager.php +++ b/src/Migration/Manager.php @@ -336,7 +336,6 @@ public function getVersionsToMark(Arguments $args): array * * @param string $path Path where to look for migrations * @param array $versions Versions which should be marked - * @param \Cake\Console\ConsoleIo $io ConsoleIo to write output too * @return list Output from the operation */ public function markVersionsAsMigrated(string $path, array $versions): array @@ -852,8 +851,8 @@ function ($phpFile) { $config = $this->getConfig(); $input = new ArrayInput([ - '--plugin' => $config['plugin'], - '--source' => $config['source'], + '--plugin' => $config['plugin'] ?? null, + '--source' => $config['source'] ?? null, '--connection' => $config->getConnection(), ]); $output = new OutputAdapter($io); @@ -971,9 +970,9 @@ public function getSeeds(): array new InputOption('source', mode: InputOption::VALUE_OPTIONAL, default: ''), ]); $input = new ArrayInput([ - '--plugin' => $config['plugin'], + '--plugin' => $config['plugin'] ?? null, + '--source' => $config['source'] ?? null, '--connection' => $config->getConnection(), - '--source' => $config['source'], ], $optionDef); $output = new OutputAdapter($this->io); diff --git a/src/Migration/ManagerFactory.php b/src/Migration/ManagerFactory.php index efeabfeb..0d996e9b 100644 --- a/src/Migration/ManagerFactory.php +++ b/src/Migration/ManagerFactory.php @@ -119,7 +119,7 @@ public function createConfig(): ConfigInterface 'migration_base_class' => 'Migrations\AbstractMigration', 'environment' => $adapterConfig, 'plugin' => $plugin, - 'source' => (string)$this->getOption('source'), + 'source' => (string)$this->getOption('source'), // TODO do we want to support the DI container in migrations? ]; diff --git a/tests/TestCase/Command/Phinx/StatusTest.php b/tests/TestCase/Command/Phinx/StatusTest.php index 22e8fd3e..97f493d9 100644 --- a/tests/TestCase/Command/Phinx/StatusTest.php +++ b/tests/TestCase/Command/Phinx/StatusTest.php @@ -185,6 +185,7 @@ public function testExecuteWithInconsistency() $migrations = $this->getMigrations(); $migrations->migrate(); + $migrations = $this->getMigrations(); $migrationPaths = $migrations->getConfig()->getMigrationPaths(); $migrationPath = array_pop($migrationPaths); $origin = $migrationPath . DS . '20150724233100_update_numbers_table.php'; @@ -248,7 +249,14 @@ protected function getMigrations() 'connection' => 'test', 'source' => 'TestsMigrations', ]; + $args = [ + '--connection' => $params['connection'], + '--source' => $params['source'], + ]; + $input = new ArrayInput($args, $this->command->getDefinition()); $migrations = new Migrations($params); + $migrations->setInput($input); + $this->command->setInput($input); $adapter = $migrations ->getManager($this->command->getConfig())