Skip to content
Open
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/HttpWorkerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ public function waitRequest(): ?Request;
* message's headers. Each key MUST be a header name, and each value MUST be an array of strings for
* that header.
*/
public function respond(int $status, string|Generator $body, array $headers = []): void;
public function respond(int $status, string|Generator $body, array $headers = [], bool $endOfStream = true): void;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix formatting and update the docblock.

Two issues to address:

  1. There's a double space before bool $endOfStream
  2. The docblock (lines 21-32) doesn't document the new $endOfStream parameter

Apply this diff to fix the formatting:

-    public function respond(int $status, string|Generator $body, array $headers = [],  bool $endOfStream = true): void;
+    public function respond(int $status, string|Generator $body, array $headers = [], bool $endOfStream = true): void;

And update the docblock to include:

      * @param HeadersList|array<array-key, array<array-key, string>> $headers $headers An associative array of the
      *        message's headers. Each key MUST be a header name, and each value MUST be an array of strings for
      *        that header.
+     * @param bool $endOfStream Whether this response marks the end of the stream. Default is true.
      */
     public function respond(int $status, string|Generator $body, array $headers = [], bool $endOfStream = true): void;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public function respond(int $status, string|Generator $body, array $headers = [], bool $endOfStream = true): void;
* @param HeadersList|array<array-key, array<array-key, string>> $headers $headers An associative array of the
* message's headers. Each key MUST be a header name, and each value MUST be an array of strings for
* @param bool $endOfStream Whether this response marks the end of the stream. Default is true.
*/
public function respond(int $status, string|Generator $body, array $headers = [], bool $endOfStream = true): void;
🤖 Prompt for AI Agents
In src/HttpWorkerInterface.php around line 33, the method signature currently
has an extra double space before "bool $endOfStream" and the docblock above
(lines ~21-32) does not document the new $endOfStream parameter; remove the
extra space so the signature reads with a single space before the type, and
update the docblock to include a @param bool $endOfStream description (e.g.,
whether this response is the final stream chunk) and any default behavior,
keeping formatting consistent with existing @param entries.

}