Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/Command/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,13 @@
$toDownload[$action->software] = $action;
}

$destinationPath = $input->getOption('path');

Check failure on line 141 in src/Command/Get.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

MixedAssignment

src/Command/Get.php:141:9: MixedAssignment: Unable to determine the type that $destinationPath is being assigned to (see https://psalm.dev/032)

Check failure on line 141 in src/Command/Get.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

MixedAssignment

src/Command/Get.php:141:9: MixedAssignment: Unable to determine the type that $destinationPath is being assigned to (see https://psalm.dev/032)

return \array_map(

Check failure on line 143 in src/Command/Get.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

LessSpecificReturnStatement

src/Command/Get.php:143:16: LessSpecificReturnStatement: The type 'array<array-key, Internal\DLoad\Module\Config\Schema\Action\Download>' is more general than the declared return type 'list<Internal\DLoad\Module\Config\Schema\Action\Download>' for Internal\DLoad\Command\Get::getDownloadActions (see https://psalm.dev/129)

Check failure on line 143 in src/Command/Get.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

LessSpecificReturnStatement

src/Command/Get.php:143:16: LessSpecificReturnStatement: The type 'array<array-key, Internal\DLoad\Module\Config\Schema\Action\Download>' is more general than the declared return type 'list<Internal\DLoad\Module\Config\Schema\Action\Download>' for Internal\DLoad\Command\Get::getDownloadActions (see https://psalm.dev/129)
static fn(string $software): DownloadConfig => $toDownload[$software] ?? self::parseSoftware($software),
static fn(string $software): DownloadConfig => $toDownload[$software] ?? self::parseSoftware(
$software,

Check failure on line 145 in src/Command/Get.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

ArgumentTypeCoercion

src/Command/Get.php:145:17: ArgumentTypeCoercion: Argument 1 of Internal\DLoad\Command\Get::parseSoftware expects non-empty-string, but parent type string provided (see https://psalm.dev/193)

Check failure on line 145 in src/Command/Get.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

ArgumentTypeCoercion

src/Command/Get.php:145:17: ArgumentTypeCoercion: Argument 1 of Internal\DLoad\Command\Get::parseSoftware expects non-empty-string, but parent type string provided (see https://psalm.dev/193)
$destinationPath,

Check failure on line 146 in src/Command/Get.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

MixedArgument

src/Command/Get.php:146:17: MixedArgument: Argument 2 of Internal\DLoad\Command\Get::parseSoftware cannot be mixed, expecting null|string (see https://psalm.dev/030)

Check failure on line 146 in src/Command/Get.php

View workflow job for this annotation

GitHub Actions / psalm (ubuntu-latest, 8.2, locked)

MixedArgument

src/Command/Get.php:146:17: MixedArgument: Argument 2 of Internal\DLoad\Command\Get::parseSoftware cannot be mixed, expecting null|string (see https://psalm.dev/030)
),
(array) $input->getArgument(self::ARG_SOFTWARE),
);
}
Expand All @@ -150,16 +155,18 @@
* Supports "name:version" format to specify exact versions.
* E.g. "rr:2.10.0", "dolt:1.2.3@beta", "temporal:1.3.1-priority", etc.
*
* @param string $software Software identifier, e.g. "rr" or "dolt:1.2.3"
* @param non-empty-string $software Software identifier, e.g. "rr" or "dolt:1.2.3"
* @param non-empty-string|null $destinationPath Optional path to store the binary
* @return DownloadConfig Parsed download configuration
*/
private static function parseSoftware(string $software): DownloadConfig
private static function parseSoftware(string $software, ?string $destinationPath): DownloadConfig
{
[$name, $version] = \explode(':', $software, 2) + [1 => ''];
$name === '' and throw new InvalidArgumentException("Software name cannot be empty, given: {$software}.");

$action = DownloadConfig::fromSoftwareId($name);
$version === '' or $action->version = $version;
$action->extractPath = $destinationPath;

return $action;
}
Expand Down
Loading