Skip to content

Commit

Permalink
Remove mandatory attributes which are optional in the official
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Dickert committed Jul 3, 2024
1 parent b7bb3d7 commit 6dfad18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/Node/Block/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ public function __construct(string $layout = 'default', bool $isNumberColumnEnab

public static function load(array $data, ?BlockNode $parent = null): self
{
self::checkNodeData(static::class, $data, ['attrs']);
self::checkRequiredKeys(['layout', 'isNumberColumnEnabled'], $data['attrs']);
self::checkNodeData(static::class, $data);

$node = new self($data['attrs']['layout'], (bool) $data['attrs']['isNumberColumnEnabled'], $data['attrs']['localId'] ?? null, $parent);
$node = new self($data['attrs']['layout'] ?? self::LAYOUT_DEFAULT, (bool) $data['attrs']['isNumberColumnEnabled'] ?? false, $data['attrs']['localId'] ?? null, $parent);

// set content if defined
if (\array_key_exists('content', $data)) {
Expand Down
4 changes: 2 additions & 2 deletions src/Node/Inline/Mention.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public function __construct(string $id, string $text, ?string $accessLevel = nul
public static function load(array $data, ?BlockNode $parent = null): self
{
self::checkNodeData(static::class, $data);
self::checkRequiredKeys(['id', 'text'], $data['attrs']);
self::checkRequiredKeys(['id'], $data['attrs']);

return new self(
$data['attrs']['id'],
$data['attrs']['text'],
$data['attrs']['text'] ?? '',
$data['attrs']['accessLevel'] ?? null,
$data['attrs']['userType'] ?? null
);
Expand Down

0 comments on commit 6dfad18

Please sign in to comment.