Merge pull request #5001 from curry684/issue-4999

Show -t incorrectly expanded self.version constraints. Fixes #4999
main
Jordi Boggiano 8 years ago
commit 3cea62b6ed

@ -19,6 +19,7 @@ use Composer\Package\Version\VersionParser;
use Composer\Plugin\CommandEvent; use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents; use Composer\Plugin\PluginEvents;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Util\Platform; use Composer\Util\Platform;
use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@ -40,6 +41,7 @@ use Composer\Spdx\SpdxLicenses;
*/ */
class ShowCommand extends BaseCommand class ShowCommand extends BaseCommand
{ {
/** @var VersionParser */
protected $versionParser; protected $versionParser;
protected $colors; protected $colors;
@ -286,20 +288,17 @@ EOT
/** /**
* finds a package by name and version if provided * finds a package by name and version if provided
* *
* @param RepositoryInterface $installedRepo * @param RepositoryInterface $installedRepo
* @param RepositoryInterface $repos * @param RepositoryInterface $repos
* @param string $name * @param string $name
* @param string $version * @param ConstraintInterface|string $version
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array array(CompletePackageInterface, array of versions) * @return array array(CompletePackageInterface, array of versions)
*/ */
protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null) protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
{ {
$name = strtolower($name); $name = strtolower($name);
$constraint = null; $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
if ($version) {
$constraint = $this->versionParser->parseConstraints($version);
}
$policy = new DefaultPolicy(); $policy = new DefaultPolicy();
$pool = new Pool('dev'); $pool = new Pool('dev');

Loading…
Cancel
Save