Skip to content

Commit

Permalink
Fix 'composer show --platform <package>' erroring if no composer.json…
Browse files Browse the repository at this point in the history
… is present (#11533)

Sort of related to #11046 (although this is not a regression, but didn't work before, either)
  • Loading branch information
dzuelke authored and Seldaek committed Sep 28, 2023
1 parent 008c8ed commit 2feeb56
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Composer/Command/ShowCommand.php
Expand Up @@ -699,7 +699,7 @@ protected function printMeta(CompletePackageInterface $package, array $versions,
$io->write('<info>homepage</info> : ' . $package->getHomepage());
$io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
$io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
if ($installedRepo->hasPackage($package)) {
if (!PlatformRepository::isPlatformPackage($package->getName()) && $installedRepo->hasPackage($package)) {
$io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
}
$io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
Expand Down Expand Up @@ -864,7 +864,7 @@ protected function printPackageInfoAsJson(CompletePackageInterface $package, arr
);
}

if ($installedRepo->hasPackage($package)) {
if (!PlatformRepository::isPlatformPackage($package->getName()) && $installedRepo->hasPackage($package)) {
$json['path'] = realpath($this->getComposer()->getInstallationManager()->getInstallPath($package));
if ($json['path'] === false) {
unset($json['path']);
Expand Down

0 comments on commit 2feeb56

Please sign in to comment.