function InstalledVersions::reload
Same name in this branch
- 11.1.x vendor/composer/composer/src/Composer/InstalledVersions.php \Composer\InstalledVersions::reload()
Lets you reload the static array from another file
This is only useful for complex integrations in which a project needs to use this class but then also needs to execute another project's autoloader in process, and wants to ensure both projects have access to their version of installed.php.
A typical case would be PHPUnit, where it would need to make sure it reads all the data it needs from this class, then call reload() with `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure the project in which it runs can then also use this class safely, without interference between PHPUnit's dependencies and the project's dependencies.
@psalm-param 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[]}>} $data
Parameters
array[] $data A vendor/composer/installed.php data set:
Return value
void
2 calls to InstalledVersions::reload()
- FilesystemRepository::safelyLoadInstalledVersions in vendor/
composer/ composer/ src/ Composer/ Repository/ FilesystemRepository.php - As we load the file from vendor dir during bootstrap, we need to make sure it contains only expected code before executing it
- FilesystemRepository::write in vendor/
composer/ composer/ src/ Composer/ Repository/ FilesystemRepository.php - Writes writable repository.
File
-
vendor/
composer/ InstalledVersions.php, line 313
Class
- InstalledVersions
- This class is copied in every Composer installed project and available to all
Namespace
ComposerCode
public static function reload($data) {
self::$installed = $data;
self::$installedByVendor = array();
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
// so we have to assume it does not, and that may result in duplicate data being returned when listing
// all installed packages for example
self::$installedIsLocalDir = false;
}