Skip to content

Commit

Permalink
Merge branch '2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jul 17, 2022
2 parents 37d3e2f + 3c68b57 commit 3595666
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/Composer/Command/PackageDiscoveryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ final protected function determineRequirements(InputInterface $input, OutputInte
$io = $this->getIO();

foreach ($requires as $requirement) {
if (isset($requirement['version']) && Preg::isMatch('{^\d+(\.\d+)?$}', $requirement['version'])) {
$io->writeError('<warning>The "'.$requirement['version'].'" constraint for "'.$requirement['name'].'" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints');
}

if (!isset($requirement['version'])) {
// determine the best version automatically
list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $platformRepo, $preferredStability, $fixed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private function createExtensionHint(array $missingExtensions): string

$ignoreExtensionsArguments = implode(" ", array_map(static function ($extension) {
return "--ignore-platform-req=$extension";
}, $missingExtensions));
}, array_unique($missingExtensions)));

$text = "To enable extensions, verify that they are enabled in your .ini files:\n - ";
$text .= implode("\n - ", $paths);
Expand Down
5 changes: 5 additions & 0 deletions src/Composer/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ public static function createOutput(): ConsoleOutput
*/
public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, ?string $cwd = null, bool $fullLoad = true, bool $disableScripts = false)
{
// if a custom composer.json path is given, we change the default cwd to be that file's directory
if (is_string($localConfig) && is_file($localConfig) && null === $cwd) {
$cwd = dirname($localConfig);
}

$cwd = $cwd ?? Platform::getCwd(true);

// load Composer configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ Your requirements could not be resolved to an installable set of packages.
To enable extensions, verify that they are enabled in your .ini files:
__inilist__
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-foobar --ignore-platform-req=ext-pcre --ignore-platform-req=ext-foobar --ignore-platform-req=ext-pcre` to temporarily ignore these required extensions.
Alternatively, you can run Composer with `--ignore-platform-req=ext-foobar --ignore-platform-req=ext-pcre` to temporarily ignore these required extensions.

--EXPECT--

0 comments on commit 3595666

Please sign in to comment.