Merge pull request #1544 from webfactory/issue_1499
Avoid unnecessary sorting changes in the composer.lockpull/1546/merge
commit
aa1c09380d
|
@ -16,6 +16,7 @@ use Composer\Package\BasePackage;
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
use Composer\Package\CompletePackageInterface;
|
use Composer\Package\CompletePackageInterface;
|
||||||
use Composer\Package\RootPackageInterface;
|
use Composer\Package\RootPackageInterface;
|
||||||
|
use Composer\Package\Link;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Konstantin Kudryashiv <ever.zet@gmail.com>
|
* @author Konstantin Kudryashiv <ever.zet@gmail.com>
|
||||||
|
@ -62,10 +63,12 @@ class ArrayDumper
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
$data[$type][$link->getTarget()] = $link->getPrettyConstraint();
|
$data[$type][$link->getTarget()] = $link->getPrettyConstraint();
|
||||||
}
|
}
|
||||||
|
ksort($data[$type]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($packages = $package->getSuggests()) {
|
if ($packages = $package->getSuggests()) {
|
||||||
|
ksort($packages);
|
||||||
$data['suggest'] = $packages;
|
$data['suggest'] = $packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +91,10 @@ class ArrayDumper
|
||||||
);
|
);
|
||||||
|
|
||||||
$data = $this->dumpValues($package, $keys, $data);
|
$data = $this->dumpValues($package, $keys, $data);
|
||||||
|
|
||||||
|
if (isset($data['keywords']) && is_array($data['keywords'])) {
|
||||||
|
sort($data['keywords']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($package instanceof RootPackageInterface) {
|
if ($package instanceof RootPackageInterface) {
|
||||||
|
|
|
@ -101,7 +101,9 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'keywords',
|
'keywords',
|
||||||
array('package', 'dependency', 'autoload')
|
array('package', 'dependency', 'autoload'),
|
||||||
|
null,
|
||||||
|
array('autoload', 'dependency', 'package')
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'bin',
|
'bin',
|
||||||
|
@ -148,6 +150,42 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
||||||
array(
|
array(
|
||||||
'support',
|
'support',
|
||||||
array('foo' => 'bar'),
|
array('foo' => 'bar'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'require',
|
||||||
|
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||||
|
'requires',
|
||||||
|
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'require-dev',
|
||||||
|
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||||
|
'devRequires',
|
||||||
|
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'suggest',
|
||||||
|
array('foo/bar' => 'very useful package', 'bar/baz' => 'another useful package'),
|
||||||
|
'suggests',
|
||||||
|
array('bar/baz' => 'another useful package', 'foo/bar' => 'very useful package')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'provide',
|
||||||
|
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||||
|
'provides',
|
||||||
|
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'replace',
|
||||||
|
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||||
|
'replaces',
|
||||||
|
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'conflict',
|
||||||
|
array(new Link('foo', 'foo/bar', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new VersionConstraint('=', '1.0.0.0'), 'requires', '1.0.0')),
|
||||||
|
'conflicts',
|
||||||
|
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue