|
|
|
|
@ -98,7 +98,7 @@ class InstalledVersions |
|
|
|
|
{ |
|
|
|
|
foreach (self::getInstalled() as $installed) { |
|
|
|
|
if (isset($installed['versions'][$packageName])) { |
|
|
|
|
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); |
|
|
|
|
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -119,7 +119,7 @@ class InstalledVersions |
|
|
|
|
*/ |
|
|
|
|
public static function satisfies(VersionParser $parser, $packageName, $constraint) |
|
|
|
|
{ |
|
|
|
|
$constraint = $parser->parseConstraints($constraint); |
|
|
|
|
$constraint = $parser->parseConstraints((string) $constraint); |
|
|
|
|
$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); |
|
|
|
|
|
|
|
|
|
return $provided->matches($constraint); |
|
|
|
|
@ -328,7 +328,9 @@ class InstalledVersions |
|
|
|
|
if (isset(self::$installedByVendor[$vendorDir])) { |
|
|
|
|
$installed[] = self::$installedByVendor[$vendorDir]; |
|
|
|
|
} elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
|
|
|
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
|
|
|
|
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ |
|
|
|
|
$required = require $vendorDir.'/composer/installed.php'; |
|
|
|
|
$installed[] = self::$installedByVendor[$vendorDir] = $required; |
|
|
|
|
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
|
|
|
self::$installed = $installed[count($installed) - 1]; |
|
|
|
|
} |
|
|
|
|
@ -340,12 +342,17 @@ class InstalledVersions |
|
|
|
|
// only require the installed.php file if this file is loaded from its dumped location, |
|
|
|
|
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
|
|
|
|
if (substr(__DIR__, -8, 1) !== 'C') { |
|
|
|
|
self::$installed = require __DIR__ . '/installed.php'; |
|
|
|
|
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ |
|
|
|
|
$required = require __DIR__ . '/installed.php'; |
|
|
|
|
self::$installed = $required; |
|
|
|
|
} else { |
|
|
|
|
self::$installed = array(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$installed[] = self::$installed; |
|
|
|
|
|
|
|
|
|
if (self::$installed !== array()) { |
|
|
|
|
$installed[] = self::$installed; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $installed; |
|
|
|
|
} |
|
|
|
|
|