Skip to content

Commit 2ea2b64

Browse files
committed
Throw an exception if maximum number of fields exceeds 10
1 parent 8a842d0 commit 2ea2b64

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Component/Notifier/Bridge/Slack/Block/SlackSectionBlock.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ public function field(string $text, bool $markdown = true): self
4545
];
4646

4747
// Maximum number of items is 10
48-
$this->options['fields'] = \array_slice($this->options['fields'], 0, 10);
48+
if (10 <= \count($this->options['fields'])) {
49+
throw new \LogicException('Maximum number of fields should not exceed 10.');
50+
}
4951

5052
return $this;
5153
}

0 commit comments

Comments
 (0)