Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/Requests/CreateAPostInAGivenStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CreateAPostInAGivenStream extends Request implements HasBody

public function __construct(
protected readonly string $streamId,
protected readonly string $text,
protected readonly ?string $text = null,
protected readonly ?string $title = null,
protected null|array|Collection $labels = null,
protected readonly bool $sticky = false,
Expand Down Expand Up @@ -53,14 +53,16 @@ protected function defaultQuery(): array

public function defaultBody(): array
{
$body = [
'text' => $this->text,
];
$body = [];

if (! empty($this->title)) {
if (filled($this->title)) {
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent use of conditional checks: filled() is used for title and text, but ! empty() is used for other optional fields like scheduledAt (line 88), labels (line 72), files (line 98), media (line 108), and options (line 118). Consider using filled() consistently for all nullable string and array fields to maintain a uniform code style.

Copilot uses AI. Check for mistakes.
$body = Arr::add(array: $body, key: 'title', value: $this->title);
}

if (filled($this->text)) {
$body = Arr::add(array: $body, key: 'text', value: $this->text);
}

$labels = $this->labels;

if ($labels instanceof Collection) {
Expand Down