From 51e08a275fb7732ff6401cc78188a59fd83ed433 Mon Sep 17 00:00:00 2001 From: Akash Karangale Date: Fri, 23 Feb 2024 15:57:48 +0530 Subject: [PATCH] GL-2039: Replace if-else with sw-case to resolve mutation warning. --- .../CodeStudio/CodeStudioWizardCommand.php | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Command/CodeStudio/CodeStudioWizardCommand.php b/src/Command/CodeStudio/CodeStudioWizardCommand.php index c4af7645c..2c6032e1e 100644 --- a/src/Command/CodeStudio/CodeStudioWizardCommand.php +++ b/src/Command/CodeStudio/CodeStudioWizardCommand.php @@ -50,23 +50,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int ]; $projectSelected = $this->io->choice('Select a project type', $projectType, $projectType[0]); - 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 = [ + '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();