1
0
Fork 0

Merge branch '2.4'

pull/11079/merge
Jordi Boggiano 2022-10-13 16:57:52 +02:00
commit 68da418f6e
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
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\Constraint\ConstraintInterface;
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;
use JsonSerializable;
class PartialSecurityAdvisory class PartialSecurityAdvisory implements JsonSerializable
{ {
/** /**
* @var string * @var string
@ -55,4 +56,16 @@ class PartialSecurityAdvisory
$this->packageName = $packageName; $this->packageName = $packageName;
$this->affectedVersions = $affectedVersions; $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->cve = $cve;
$this->link = $link; $this->link = $link;
} }
/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
$data = parent::jsonSerialize();
$data['reportedAt'] = $data['reportedAt']->format(DATE_RFC3339);
return $data;
}
} }