Skip to content

Commit

Permalink
CLI-175: [app:new:from:drupal7] argument path must be of type string (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell authored Nov 13, 2023
1 parent 7aa3083 commit ccd1079
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
12 changes: 2 additions & 10 deletions src/Command/App/NewFromDrupal7Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class NewFromDrupal7Command extends CommandBase {

protected function configure(): void {
$this->setDescription('Generate a new Drupal 9+ project from a Drupal 7 application using the default Acquia Migrate Accelerate recommendations.')
->addOption('drupal7-directory', 'source', InputOption::VALUE_OPTIONAL, 'The root of the Drupal 7 application.')
->addOption('drupal7-directory', 'source', InputOption::VALUE_OPTIONAL, 'The root of the Drupal 7 application')
->addOption('drupal7-uri', 'uri', InputOption::VALUE_OPTIONAL, 'Only necessary in case of a multisite. If a single site, this will be computed automatically.')
->addOption('stored-analysis', 'analysis', InputOption::VALUE_OPTIONAL, 'As an alternative to drupal7-directory, it is possible to pass a stored analysis.')
->addOption('recommendations', 'recommendations', InputOption::VALUE_OPTIONAL, 'Overrides the default recommendations.')
Expand All @@ -66,15 +66,7 @@ private function getInspector(InputInterface $input): SiteInspectorInterface {
}

// First: Determine the Drupal 7 root.
if ($input->getOption('drupal7-directory') === NULL) {
$answer = $this->io->ask(
'What is the root of the Drupal 7 application you want to generate a new Drupal project for?',
NULL,
[Drupal7SiteInspector::class, 'validateDrupal7Root'],
);
$input->setOption('drupal7-directory', $answer);
}
$d7_root = $input->getOption('drupal7-directory');
$d7_root = $this->determineOption('drupal7-directory', FALSE, Drupal7SiteInspector::validateDrupal7Root(...), NULL, '.');

// Second, determine which "sites" subdirectory is being assessed.
$uri = Drupal7SiteInspector::getSiteUri($input, $d7_root);
Expand Down
4 changes: 2 additions & 2 deletions src/Command/CommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ protected function promptOpenBrowserToCreateToken(
}

protected function determineApiKey(): string {
return $this->determineOption('key', FALSE, Closure::fromCallable([$this, 'validateApiKey']));
return $this->determineOption('key', FALSE, $this->validateApiKey(...));
}

private function validateApiKey(mixed $key): string {
Expand All @@ -1343,7 +1343,7 @@ private function validateApiKey(mixed $key): string {
}

protected function determineApiSecret(): string {
return $this->determineOption('secret', TRUE, Closure::fromCallable([$this, 'validateApiKey']));
return $this->determineOption('secret', TRUE, $this->validateApiKey(...));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Ide/IdeCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$accountResource = new Account($acquiaCloudClient);
$account = $accountResource->get();
$default = "$account->first_name $account->last_name's IDE";
$ideLabel = $this->determineOption('label', FALSE, \Closure::fromCallable([$this, 'validateIdeLabel']), NULL, $default);
$ideLabel = $this->determineOption('label', FALSE, $this->validateIdeLabel(...), NULL, $default);

// Create it.
$checklist->addItem('Creating your Cloud IDE');
Expand Down
7 changes: 3 additions & 4 deletions src/Command/Ssh/SshKeyCommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use AcquiaCloudApi\Connector\Client;
use AcquiaCloudApi\Endpoints\SshKeys;
use AcquiaCloudApi\Response\IdeResponse;
use Closure;
use React\EventLoop\Loop;
use RuntimeException;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -247,7 +246,7 @@ protected function determineFilename(): string {
return $this->determineOption(
'filename',
FALSE,
Closure::fromCallable([$this, 'validateFilename']),
$this->validateFilename(...),
static function (mixed $value) {
return $value ? trim($value) : '';},
'id_rsa_acquia'
Expand All @@ -271,7 +270,7 @@ protected function determinePassword(): string {
return $this->determineOption(
'password',
TRUE,
Closure::fromCallable([$this, 'validatePassword']),
$this->validatePassword(...),
static function (mixed $value) {
return $value ? trim($value) : '';
}
Expand Down Expand Up @@ -344,7 +343,7 @@ private function promptChooseLocalSshKey(array $localKeys): string {
}

protected function determineSshKeyLabel(): string {
return $this->determineOption('label', FALSE, Closure::fromCallable([$this, 'validateSshKeyLabel']), Closure::fromCallable([$this, 'normalizeSshKeyLabel']));
return $this->determineOption('label', FALSE, $this->validateSshKeyLabel(...), $this->normalizeSshKeyLabel(...));
}

private function validateSshKeyLabel(mixed $label): mixed {
Expand Down

0 comments on commit ccd1079

Please sign in to comment.