1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-11 01:22:54 +00:00

Store dev mode in installed.json, fixes #3008

This commit is contained in:
Jordi Boggiano 2019-02-21 12:27:02 +01:00
parent 8fe2b9ec69
commit 60df892517
No known key found for this signature in database
GPG key ID: 7BBD42C429EC80BC
7 changed files with 21 additions and 13 deletions

View file

@ -49,7 +49,12 @@ class FilesystemRepository extends WritableArrayRepository
}
try {
$packages = $this->file->read();
$data = $this->file->read();
if (isset($data['packages'])) {
$packages = $data['packages'];
} else {
$packages = $data;
}
if (!is_array($packages)) {
throw new \UnexpectedValueException('Could not parse package list from the repository');
@ -74,16 +79,16 @@ class FilesystemRepository extends WritableArrayRepository
/**
* Writes writable repository.
*/
public function write()
public function write($devMode)
{
$data = array();
$data = array('packages' => array(), 'dev' => $devMode);
$dumper = new ArrayDumper();
foreach ($this->getCanonicalPackages() as $package) {
$data[] = $dumper->dump($package);
$data['packages'][] = $dumper->dump($package);
}
usort($data, function ($a, $b) {
usort($data['packages'], function ($a, $b) {
return strcmp($a['name'], $b['name']);
});