Skip to content

Commit

Permalink
GL-2039: Replace if-else with sw-case to resolve mutation warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
akashkska committed Feb 23, 2024
1 parent 8c0d2da commit 51e08a2
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/Command/CodeStudio/CodeStudioWizardCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int
];
$projectSelected = $this->io->choice('Select a project type', $projectType, $projectType[0]);

Check warning on line 51 in src/Command/CodeStudio/CodeStudioWizardCommand.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ $phpVersion = NULL; $nodeVersion = NULL; $projectType = ['Drupal_project', 'Node_project']; - $projectSelected = $this->io->choice('Select a project type', $projectType, $projectType[0]); + $projectSelected = $this->io->choice('Select a project type', $projectType, $projectType[1]); switch ($projectSelected) { case "Drupal_project": $phpVersions = ['PHP_version_8.1' => "8.1", 'PHP_version_8.2' => "8.2"];

if ($projectSelected == 'Drupal_project') {
$phpVersions = [
'PHP_version_8.1' => "8.1",
'PHP_version_8.2' => "8.2",
];
$project = $this->io->choice('Select a PHP version', array_values($phpVersions), $phpVersions['PHP_version_8.1']);
$project = array_search($project, $phpVersions, TRUE);
$phpVersion = $phpVersions[$project];
}
elseif ($projectSelected == 'Node_project') {
$nodeVersions = [
'NODE_version_18.17.1' => "18.17.1",
'NODE_version_20.5.1' => "20.5.1",
];
$project = $this->io->choice('Select a NODE version', array_values($nodeVersions), $nodeVersions['NODE_version_20.5.1']);
$project = array_search($project, $nodeVersions, TRUE);
$nodeVersion = $nodeVersions[$project];
switch ($projectSelected) {
case "Drupal_project":
$phpVersions = [
'PHP_version_8.1' => "8.1",
'PHP_version_8.2' => "8.2",
];
$project = $this->io->choice('Select a PHP version', array_values($phpVersions), $phpVersions['PHP_version_8.1']);
$project = array_search($project, $phpVersions, TRUE);
$phpVersion = $phpVersions[$project];
break;
case "Node_project":
$nodeVersions = [

Check warning on line 64 in src/Command/CodeStudio/CodeStudioWizardCommand.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ $phpVersion = $phpVersions[$project]; break; case "Node_project": - $nodeVersions = ['NODE_version_18.17.1' => "18.17.1", 'NODE_version_20.5.1' => "20.5.1"]; + $nodeVersions = ['NODE_version_20.5.1' => "20.5.1"]; $project = $this->io->choice('Select a NODE version', array_values($nodeVersions), $nodeVersions['NODE_version_20.5.1']); $project = array_search($project, $nodeVersions, TRUE); $nodeVersion = $nodeVersions[$project];
'NODE_version_18.17.1' => "18.17.1",
'NODE_version_20.5.1' => "20.5.1",
];
$project = $this->io->choice('Select a NODE version', array_values($nodeVersions), $nodeVersions['NODE_version_20.5.1']);
$project = array_search($project, $nodeVersions, TRUE);
$nodeVersion = $nodeVersions[$project];
break;
}

$appUuid = $this->determineCloudApplication();
Expand Down

0 comments on commit 51e08a2

Please sign in to comment.