Updated classes fromArray signatures (in-progress)

This commit is contained in:
netkas 2024-10-03 21:14:27 -04:00
parent 59f6875edf
commit dfb812237b
43 changed files with 288 additions and 75 deletions

View file

@ -37,8 +37,13 @@ class BackgroundFillFreeformGradient extends BackgroundFill implements ObjectTyp
/**
* @inheritDoc
*/
public static function fromArray(array $data): BackgroundFill
public static function fromArray(?array $data): ?BackgroundFillFreeformGradient
{
if($data === null)
{
return null;
}
$object = new self();
$object->type = BackgroundFillType::FREEFORM_GRADIENT;

View file

@ -57,8 +57,13 @@ class BackgroundFillGradient extends BackgroundFill implements ObjectTypeInterfa
/**
* @inheritDoc
*/
public static function fromArray(array $data): BackgroundFillGradient
public static function fromArray(?array $data): ?BackgroundFillGradient
{
if($data === null)
{
return null;
}
$object = new self();
$object->type = $data['type'] ?? null;
$object->top_color = $data['top_color'] ?? 0;

View file

@ -34,10 +34,14 @@ class BackgroundFillSolid extends BackgroundFill implements ObjectTypeInterface
/**
* @inheritDoc
*/
public static function fromArray(array $data): BackgroundFill
public static function fromArray(?array $data): ?BackgroundFillSolid
{
$object = new self();
if($data === null)
{
return null;
}
$object = new self();
$object->type = BackgroundFillType::SOLID;
$object->color = $data['color'];