Skip to content

Commit dafd6de

Browse files
committed
polish: handling for empty next_cursor
- and add return type to StartCursor '__toString'
1 parent 0fdd0c0 commit dafd6de

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Entities/Collections/EntityCollection.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,10 @@ public function hasMoreEntries(): bool
170170
/**
171171
* @return StartCursor
172172
*/
173-
public function nextCursor(): StartCursor
173+
public function nextCursor(): ?StartCursor
174174
{
175-
return new StartCursor($this->getRawNextCursor());
175+
$rawNextCursor = $this->getRawNextCursor();
176+
if($rawNextCursor === null) return null;
177+
return new StartCursor($rawNextCursor);
176178
}
177179
}

src/Query/StartCursor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(string $cursor)
2222
$this->cursor = $cursor;
2323
}
2424

25-
public function __toString()
25+
public function __toString(): string
2626
{
2727
return $this->cursor;
2828
}

0 commit comments

Comments
 (0)