Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4ccef63

Browse files
Merge pull request #58 from 5am-code/dev
Dev to Master: v0.6.2
2 parents 20a7fcc + 1169e6c commit 4ccef63

File tree

16 files changed

+82
-13
lines changed

16 files changed

+82
-13
lines changed

‎.github/workflows/main.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
php:
13+
- '8.1'
1314
- '8.0'
15+
- '7.4'
1416
laravel:
1517
- '8.*'
1618
testbench:

‎src/Endpoints/Block.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,12 @@ public function children(): BlockCollection
8181
*
8282
* @throws HandlingException
8383
*/
84-
public function append(array|BlockEntity$appendices): BlockEntity
84+
public function append($appendices): BlockEntity
8585
{
86+
if (! is_array($appendices) && ! $appendices instanceof BlockEntity) {
87+
throw new HandlingException('$appendices must be an array or instance of BlockEntity');
88+
}
89+
8690
if (! is_array($appendices)) {
8791
$appendices = [$appendices];
8892
}

‎src/Entities/Blocks/Block.php‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,11 @@ private static function mapTypeToClass(string $type): string
212212
return Block::class;
213213
}
214214
}
215+
216+
protected static function assertValidTextContent($textContent)
217+
{
218+
if (! is_array($textContent) && ! is_string($textContent)) {
219+
throw new HandlingException('$textContent content must be a string or an array.');
220+
}
221+
}
215222
}

‎src/Entities/Blocks/BulletedListItem.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
*/
88
class BulletedListItem extends TextBlock
99
{
10-
public static function create(array|string$textContent): BulletedListItem
10+
public static function create($textContent): BulletedListItem
1111
{
12+
self::assertValidTextContent($textContent);
13+
1214
$bulletedListItem = new BulletedListItem();
1315
TextBlock::createTextBlock($bulletedListItem, $textContent);
1416

‎src/Entities/Blocks/HeadingOne.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
*/
88
class HeadingOne extends TextBlock
99
{
10-
public static function create(array|string$textContent): HeadingOne
10+
public static function create($textContent): HeadingOne
1111
{
12+
self::assertValidTextContent($textContent);
13+
1214
$headingOne = new HeadingOne();
1315
TextBlock::createTextBlock($headingOne, $textContent);
1416

‎src/Entities/Blocks/HeadingThree.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
*/
88
class HeadingThree extends TextBlock
99
{
10-
public static function create(array|string$textContent): HeadingThree
10+
public static function create($textContent): HeadingThree
1111
{
12+
self::assertValidTextContent($textContent);
13+
1214
$headingThree = new HeadingThree();
1315
HeadingThree::createTextBlock($headingThree, $textContent);
1416

‎src/Entities/Blocks/HeadingTwo.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
*/
88
class HeadingTwo extends TextBlock
99
{
10-
public static function create(array|string$textContent): HeadingTwo
10+
public static function create($textContent): HeadingTwo
1111
{
12+
self::assertValidTextContent($textContent);
13+
1214
$headingTwo = new HeadingTwo();
1315
HeadingTwo::createTextBlock($headingTwo, $textContent);
1416

‎src/Entities/Blocks/NumberedListItem.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
*/
88
class NumberedListItem extends TextBlock
99
{
10-
public static function create(array|string$textContent): NumberedListItem
10+
public static function create($textContent): NumberedListItem
1111
{
12+
self::assertValidTextContent($textContent);
13+
1214
$numberedListItem = new NumberedListItem();
1315
TextBlock::createTextBlock($numberedListItem, $textContent);
1416

‎src/Entities/Blocks/Paragraph.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
*/
88
class Paragraph extends TextBlock
99
{
10-
public static function create(array|string$textContent): Paragraph
10+
public static function create($textContent): Paragraph
1111
{
12+
self::assertValidTextContent($textContent);
13+
1214
$paragraph = new Paragraph();
1315
TextBlock::createTextBlock($paragraph, $textContent);
1416

‎src/Entities/Blocks/TextBlock.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
*/
1111
class TextBlock extends Block implements Modifiable
1212
{
13-
protected static function createTextBlock(TextBlock $textBlock, array|string$textContent): TextBlock
13+
protected static function createTextBlock(TextBlock $textBlock, $textContent): TextBlock
1414
{
15+
self::assertValidTextContent($textContent);
16+
1517
if (is_string($textContent)) {
1618
$textContent = [$textContent];
1719
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /