Skip to content

Don't use Yii DB deprecated methods in Migrator #1383

Don't use Yii DB deprecated methods in Migrator

Don't use Yii DB deprecated methods in Migrator #1383

Triggered via pull request July 11, 2024 08:00
@vjikvjik
synchronize #268
fix-psalm
Status Success
Total duration 11m 10s
Artifacts

mutation.yml

on: pull_request
Matrix: mutation
Fit to window
Zoom out
Zoom in

Annotations

11 warnings
PHP 8.3-ubuntu-latest
The following actions uses Node.js version which is deprecated and will be forced to run on node20: actions/checkout@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
PHP 8.3-ubuntu-latest: src/Command/CreateCommand.php#L144
Escaped Mutant for Mutator "GreaterThan": --- Original +++ New @@ @@ $name = $this->generateName($command, $table, $and); $className = $this->migrationService->generateClassName($name); $nameLimit = $this->migrator->getMigrationNameLimit(); - if ($nameLimit !== 0 && strlen($className) > $nameLimit) { + if ($nameLimit !== 0 && strlen($className) >= $nameLimit) { $io->error('The migration name is too long.'); return Command::INVALID; }
PHP 8.3-ubuntu-latest: src/Command/CreateCommand.php#L187
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ $file = $migrationPath . DIRECTORY_SEPARATOR . $className . '.php'; file_put_contents($file, $content, LOCK_EX); $output->writeln("\n\t<info>{$className}</info>"); - $output->writeln("\n"); + $io->success('New migration created successfully.'); } $this->migrationService->databaseConnection();
PHP 8.3-ubuntu-latest: src/Command/CreateCommand.php#L204
Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ 'create' => $name, 'table' => 'Create_' . $name . '_Table', 'dropTable' => 'Drop_' . $name . '_Table', - 'addColumn' => 'Add_Column_' . $name, + 'addColumn' => $name, 'dropColumn' => 'Drop_Column_' . $name, 'junction' => 'Junction_Table_For_' . $name . '_And_' . (string) $and . '_Tables', default => $result,
PHP 8.3-ubuntu-latest: src/Command/NewCommand.php#L50
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ } protected function configure() : void { - $this->addOption('limit', 'l', InputOption::VALUE_REQUIRED, 'Number of migrations to display.', 10)->addOption('all', 'a', InputOption::VALUE_NONE, 'All new migrations.')->addOption('path', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Path to migrations to display.')->addOption('namespace', 'ns', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Namespace of migrations to display.'); + $this->addOption('limit', 'l', InputOption::VALUE_REQUIRED, 'Number of migrations to display.', 11)->addOption('all', 'a', InputOption::VALUE_NONE, 'All new migrations.')->addOption('path', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Path to migrations to display.')->addOption('namespace', 'ns', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Namespace of migrations to display.'); } protected function execute(InputInterface $input, OutputInterface $output) : int {
PHP 8.3-ubuntu-latest: src/Command/UpdateCommand.php#L99
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ if (empty($migrations)) { $output->writeln("<fg=green> >>> No new migrations found.</>\n"); $io->success('Your system is up-to-date.'); - $this->migrationService->databaseConnection(); + return Command::SUCCESS; } $migrationsCount = count($migrations);
PHP 8.3-ubuntu-latest: src/Command/UpdateCommand.php#L107
Escaped Mutant for Mutator "GreaterThan": --- Original +++ New @@ @@ } $migrationsCount = count($migrations); $migrationWord = $migrationsCount === 1 ? 'migration' : 'migrations'; - if ($limit !== null && $migrationsCount > $limit) { + if ($limit !== null && $migrationsCount >= $limit) { $migrations = array_slice($migrations, 0, $limit); $output->writeln("<fg=yellow>Total {$limit} out of {$migrationsCount} new {$migrationWord} to be applied:</>\n"); } else {
PHP 8.3-ubuntu-latest: src/Command/UpdateCommand.php#L118
Escaped Mutant for Mutator "GreaterThan": --- Original +++ New @@ @@ } foreach ($migrations as $i => $migration) { $nameLimit = $this->migrator->getMigrationNameLimit(); - if (strlen($migration) > $nameLimit) { + if (strlen($migration) >= $nameLimit) { $output->writeln("\n<fg=red>The migration name '{$migration}' is too long. Its not possible to apply " . 'this migration.</>'); return Command::INVALID; }
PHP 8.3-ubuntu-latest: src/Command/UpdateCommand.php#L127
Escaped Mutant for Mutator "Plus": --- Original +++ New @@ @@ $output->writeln("\n<fg=red>The migration name '{$migration}' is too long. Its not possible to apply " . 'this migration.</>'); return Command::INVALID; } - $output->writeln("\t<fg=yellow>" . ($i + 1) . ". {$migration}</>"); + $output->writeln("\t<fg=yellow>" . ($i - 1) . ". {$migration}</>"); } /** @var QuestionHelper $helper */ $helper = $this->getHelper('question');
PHP 8.3-ubuntu-latest: src/Command/UpdateCommand.php#L144
Escaped Mutant for Mutator "Plus": --- Original +++ New @@ @@ $migrationWas = $migrationsCount === 1 ? 'migration was' : 'migrations were'; foreach ($instances as $i => $instance) { try { - $this->updateRunner->run($instance, $i + 1); + $this->updateRunner->run($instance, $i - 1); } catch (Throwable $e) { $output->writeln("\n<fg=yellow> >>> Total {$i} out of {$migrationsCount} new {$migrationWas} applied.</>\n"); $io->error($i > 0 ? 'Partially updated.' : 'Not updated.');
PHP 8.3-ubuntu-latest: src/Service/MigrationService.php#L141
Escaped Mutant for Mutator "Continue_": --- Original +++ New @@ @@ foreach ($migrationPaths as $item) { [$sourcePath, $namespace] = $item; if (!is_dir($sourcePath)) { - continue; + break; } $handle = opendir($sourcePath); while (($file = readdir($handle)) !== false) {