Skip to content

Commit a4068ee

Browse files
authored
Merge pull request #319 from asgrim/clarify-pre-packaged-source-branch-alias
Improve exception when using pre-packaged-source and a branch alias
2 parents 3961d1b + eb6965b commit a4068ee

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/Downloading/Exception/CouldNotFindReleaseAsset.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use function implode;
1313
use function sprintf;
1414

15+
use const PHP_EOL;
16+
1517
class CouldNotFindReleaseAsset extends RuntimeException
1618
{
1719
/** @param non-empty-list<non-empty-string> $expectedAssetNames */
@@ -37,6 +39,19 @@ public static function forPackage(TargetPlatform $targetPlatform, Package $packa
3739

3840
public static function forPackageWithMissingTag(Package $package): self
3941
{
42+
if (
43+
$package->downloadUrlMethod() === DownloadUrlMethod::PrePackagedSourceDownload
44+
&& $package->composerPackage()->isDev()
45+
) {
46+
return new self(sprintf(
47+
'The package %s uses pre-packaged source archives, which are not available for branch aliases such as %s. You should either omit the version constraint to use the latest compatible version, or use a tagged version instead. You can find a list of tagged versions on:%shttps://packagist.org/packages/%s',
48+
$package->name(),
49+
$package->version(),
50+
PHP_EOL . PHP_EOL,
51+
$package->name(),
52+
));
53+
}
54+
4055
return new self(sprintf(
4156
'Could not find release by tag name for %s',
4257
$package->prettyNameAndVersion(),

0 commit comments

Comments
 (0)