Fix json format of audit command missing affectedVersions, fix reportedAt format (BC BREAK!), fixes #11104 (#11120)
parent
4faa8c03ce
commit
f6e67e584e
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue