1
0
Fork 0

Avoid dumping null values for dist reference/shasum and source reference, fixes #7955

pull/7928/head
Jordi Boggiano 2019-02-10 12:39:00 +01:00
parent eee98018f7
commit 408df4b878
2 changed files with 10 additions and 4 deletions

View File

@ -48,7 +48,9 @@ class ArrayDumper
if ($package->getSourceType()) { if ($package->getSourceType()) {
$data['source']['type'] = $package->getSourceType(); $data['source']['type'] = $package->getSourceType();
$data['source']['url'] = $package->getSourceUrl(); $data['source']['url'] = $package->getSourceUrl();
$data['source']['reference'] = $package->getSourceReference(); if (null !== ($value = $package->getSourceReference())) {
$data['source']['reference'] = $value;
}
if ($mirrors = $package->getSourceMirrors()) { if ($mirrors = $package->getSourceMirrors()) {
$data['source']['mirrors'] = $mirrors; $data['source']['mirrors'] = $mirrors;
} }
@ -57,8 +59,12 @@ class ArrayDumper
if ($package->getDistType()) { if ($package->getDistType()) {
$data['dist']['type'] = $package->getDistType(); $data['dist']['type'] = $package->getDistType();
$data['dist']['url'] = $package->getDistUrl(); $data['dist']['url'] = $package->getDistUrl();
$data['dist']['reference'] = $package->getDistReference(); if (null !== ($value = $package->getDistReference())) {
$data['dist']['shasum'] = $package->getDistSha1Checksum(); $data['dist']['reference'] = $value;
}
if (null !== ($value = $package->getDistSha1Checksum())) {
$data['dist']['shasum'] = $value;
}
if ($mirrors = $package->getDistMirrors()) { if ($mirrors = $package->getDistMirrors()) {
$data['dist']['mirrors'] = $mirrors; $data['dist']['mirrors'] = $mirrors;
} }

View File

@ -85,7 +85,7 @@ class ArrayLoader implements LoaderInterface
} }
$package->setSourceType($config['source']['type']); $package->setSourceType($config['source']['type']);
$package->setSourceUrl($config['source']['url']); $package->setSourceUrl($config['source']['url']);
$package->setSourceReference($config['source']['reference']); $package->setSourceReference(isset($config['source']['reference']) ? $config['source']['reference'] : null);
if (isset($config['source']['mirrors'])) { if (isset($config['source']['mirrors'])) {
$package->setSourceMirrors($config['source']['mirrors']); $package->setSourceMirrors($config['source']['mirrors']);
} }