Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d06796e

Browse files
committed
Warn if why-not is used with a version which does not exist/is not found, fixes #11070
1 parent 5f0aa01 commit d06796e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/Composer/Command/BaseDependencyCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ protected function doExecute(InputInterface $input, OutputInterface $output, boo
9494
2,
9595
$input->hasArgument(self::ARGUMENT_CONSTRAINT) ? $input->getArgument(self::ARGUMENT_CONSTRAINT) : '*'
9696
);
97+
if (!$input->hasArgument(self::ARGUMENT_CONSTRAINT)) {
98+
$textConstraint = '*';
99+
}
97100

98101
// Find packages that are or provide the requested package first
99102
$packages = $installedRepo->findPackagesWithReplacersAndProviders($needle);
@@ -107,6 +110,8 @@ protected function doExecute(InputInterface $input, OutputInterface $output, boo
107110
$defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO(), $composer->getConfig(), $composer->getRepositoryManager()));
108111
if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
109112
$installedRepo->addRepository(new InstalledArrayRepository([clone $match]));
113+
} else {
114+
$this->getIO()->writeError('<error>Package "'.$needle.'" could not be found with constraint "'.$textConstraint.'", results below will most likely be incomplete.</error>');
110115
}
111116
}
112117

0 commit comments

Comments
 (0)