Skip to content

Conversation

@abnegate
Copy link
Member

@abnegate abnegate commented Aug 26, 2025

Summary by CodeRabbit

  • Chores
    • Updated dependencies to require Swoole 6.x and aligned development tooling for improved editor support. No runtime behavior changes.
  • Refactor
    • Adjusted internal cookie handling to align with Swoole 6 conventions. Public API and functionality remain unchanged.

@coderabbitai
Copy link

coderabbitai bot commented Aug 26, 2025

Walkthrough

composer.json tightens Swoole dependency versions (ext-swoole to 6.x, swoole/ide-helper to 6.0.2). In src/Swoole/Response.php, the named argument for Swoole’s cookie() first parameter is updated from name to name_or_object. No control flow or public API changes.

Changes

Cohort / File(s) Summary
Dependency constraints
composer.json
Require ext-swoole changed from "*" to "6.*". Require-dev swoole/ide-helper updated from "5.0.2" to "6.0.2".
Swoole cookie call update
src/Swoole/Response.php
In Response::sendCookie, renamed named-argument for Swoole cookie() first parameter from name to name_or_object; other arguments unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

I twitch my whiskers, versions hop in line,
Swoole 6 now purrs—dependencies align.
A cookie’s name-or-object, neat and tight,
I nibble through diffs by moonlit byte.
Thump-thump, ship it—clean and bright! 🐇🍪✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch v6

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@abnegate abnegate closed this Aug 26, 2025
@abnegate abnegate deleted the v6 branch August 26, 2025 05:26
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/Swoole/Response.php (2)

188-191: - PHP 8.4 deprecation: make $content explicitly nullable and avoid passing null to Swoole end()

Defaulting a string-typed parameter to null is deprecated in PHP 8.4. Update the signature and safely pass an empty string if no content is provided. Swoole’s end() expects a string; sending an empty body is equivalent to calling end() with no argument. (php.net, openswoole.com)

Apply:

-    protected function end(string $content = null): void
+    protected function end(?string $content = null): void
     {
-        $this->swoole->end($content);
+        $this->swoole->end($content ?? '');
     }

245-257: Fix Swoole v6 cookie() call – use positional arguments
The named argument name_or_object isn’t supported in Swoole v6 and is causing CI failures under CodeQL. Replace the named-arg call with positional arguments (which remain stable across versions) and update the docblock so that samesite is typed as a string.

Affected location:
• src/Swoole/Response.php (around lines 245–257)

Required changes:

     protected function sendCookie(string $name, string $value, array $options): void
     {
-        $this->swoole->cookie(
-            name_or_object: $name,
-            value: $value,
-            expires: $options['expire'] ?? 0,
-            path: $options['path'] ?? '',
-            domain: $options['domain'] ?? '',
-            secure: $options['secure'] ?? false,
-            httponly: $options['httponly'] ?? false,
-            samesite: $options['samesite'] ?? false,
-        );
+        $this->swoole->cookie(
+            $name,
+            $value,
+            $options['expire']   ?? 0,
+            $options['path']     ?? '',
+            $options['domain']   ?? '',
+            (bool)($options['secure']    ?? false),
+            (bool)($options['httponly']  ?? false),
+            (string)($options['samesite'] ?? '')
+        );
     }

Also update the docblock for $options to reflect that samesite is a string:

- *   samesite?: bool
+ *   samesite?: string

I scanned the entire codebase for any other named‐arg calls to cookie() or setCookie() and found none—this is the only spot that needs adjustment.

🧹 Nitpick comments (1)
src/Swoole/Response.php (1)

218-221: Pass status code as int (minor type clean-up)

Swoole expects an int for the first argument to status(); avoid casting to string. (openswoole.com)

-        $this->swoole->status((string) $statusCode, $this->getStatusCodeReason($statusCode));
+        $this->swoole->status($statusCode, $this->getStatusCodeReason($statusCode));
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1af73dd and b682c3e.

⛔ Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • composer.json (1 hunks)
  • src/Swoole/Response.php (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: CodeQL
src/Swoole/Response.php

[error] 188-188: Deprecated in PHP 8.4: Parameter #1 $content (string) is implicitly nullable via default value null.


[error] 247-247: Missing parameter $name (mixed) in call to method Swoole\Http\Response::cookie().


[error] 248-248: Unknown parameter $name_or_object in call to method Swoole\Http\Response::cookie().

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Unit & E2E

Comment on lines 16 to 23
"php": ">=8.0",
"ext-swoole": "*",
"ext-swoole": "6.*",
"utopia-php/framework": "0.33.*"
},
"require-dev": {
"phpunit/phpunit": "^9.3",
"swoole/ide-helper": "5.0.2",
"swoole/ide-helper": "6.0.2",
"laravel/pint": "1.2.*",
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Align PHP engine constraint with Swoole 6 requirements

You’ve bumped ext-swoole to 6.* and ide-helper to 6.0.2 (good), but composer still allows PHP >=8.0. Swoole 6 requires PHP >=8.1 per PECL/Packagist. Tighten the PHP constraint to prevent unsatisfiable installs on PHP 8.0 environments. (pecl.php.net, packagist.org)

-        "php": ">=8.0",
+        "php": ">=8.1",
         "ext-swoole": "6.*",
📝 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
"php": ">=8.0",
"ext-swoole": "*",
"ext-swoole": "6.*",
"utopia-php/framework": "0.33.*"
},
"require-dev": {
"phpunit/phpunit": "^9.3",
"swoole/ide-helper": "5.0.2",
"swoole/ide-helper": "6.0.2",
"laravel/pint": "1.2.*",
"php": ">=8.1",
"ext-swoole": "6.*",
"utopia-php/framework": "0.33.*"
},
"require-dev": {
"phpunit/phpunit": "^9.3",
"swoole/ide-helper": "6.0.2",
"laravel/pint": "1.2.*",
🤖 Prompt for AI Agents
In composer.json around lines 16 to 23, the PHP engine constraint is ">=8.0" but
ext-swoole is set to "6.*" which requires PHP >=8.1; update the "php"
requirement to ">=8.1" (or a more specific range that includes 8.1+) so Composer
won't allow installs on PHP 8.0 and avoids unsatisfiable dependency resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants