1
0
Fork 0

Fix json format of audit command missing affectedVersions, fix reportedAt format (BC BREAK!), fixes #11104 (#11120)

pull/11079/merge
Jordi Boggiano 2022-10-13 16:56:21 +02:00 committed by GitHub
parent 4faa8c03ce
commit f6e67e584e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View File

@ -14,8 +14,9 @@ namespace Composer\Advisory;
use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Semver\VersionParser;
use JsonSerializable;
class PartialSecurityAdvisory
class PartialSecurityAdvisory implements JsonSerializable
{
/**
* @var string
@ -55,4 +56,16 @@ class PartialSecurityAdvisory
$this->packageName = $packageName;
$this->affectedVersions = $affectedVersions;
}
/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
$data = (array) $this;
$data['affectedVersions'] = $data['affectedVersions']->getPrettyString();
return $data;
}
}

View File

@ -61,4 +61,16 @@ class SecurityAdvisory extends PartialSecurityAdvisory
$this->cve = $cve;
$this->link = $link;
}
/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
$data = parent::jsonSerialize();
$data['reportedAt'] = $data['reportedAt']->format(DATE_RFC3339);
return $data;
}
}