Skip to content

Conversation

@okorneliuk
Copy link
Contributor

@okorneliuk okorneliuk commented May 18, 2025

Summary by CodeRabbit

  • Chores
    • Expanded supported versions for a key dependency to include newer releases.
    • Marked several exception classes as final via documentation annotations to clarify intended usage.
    • Added explicit override annotations to methods implementing or overriding parent or interface methods, enhancing code clarity.

@coderabbitai
Copy link

coderabbitai bot commented May 18, 2025

Walkthrough

The changes introduce the PHP #[\Override] attribute to methods across multiple classes and an interface that implement or override parent or interface methods, enhancing code clarity. Several exception classes are now annotated as @final via PHPDoc. Additionally, the composer.json dependency constraint for "spiral/roadrunner" is broadened to include a newer version, and a new dependency "symfony/polyfill-php83" is added.

Changes

File(s) Change Summary
composer.json Expanded "spiral/roadrunner" version constraint in "require" to allow "^2024.3" or "^2025.1"; added new dependency "symfony/polyfill-php83" with version "*".
src/Context.php Added #[\Override] attribute to all public methods overriding interface or parent class methods.
src/Exception/GRPCException.php Added #[\Override] attribute to getDetails(), setDetails(array $details), and addDetails(Message $message) methods.
src/Exception/GRPCExceptionInterface.php Added #[\Override] attribute to the getCode() method in the interface.
src/Exception/NotFoundException.php
src/Exception/ServiceException.php
src/Exception/UnauthenticatedException.php
src/Exception/UnimplementedException.php
Added PHPDoc @final annotation to each class, indicating they should not be extended.
src/Invoker.php Added #[\Override] attribute to the invoke method.
src/ResponseHeaders.php Added #[\Override] attribute to getIterator() and count() methods.
src/ResponseTrailers.php Added #[\Override] attribute to getIterator() and count() methods.

Poem

In fields of code where rabbits hop,
We mark our overrides, we never stop!
Exceptions now are final, set in stone,
Composer’s road runs further, not alone.
With every tweak and tidy line,
Our PHP garden grows just fine!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9f289e7 and 58d93bd.

📒 Files selected for processing (1)
  • composer.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • composer.json

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

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: 0

🧹 Nitpick comments (4)
src/Exception/UnimplementedException.php (1)

9-11: Prefer native final keyword over PHPDoc @final

Psalm will honor the @final annotation, but using the language-level final keyword enforces immutability at runtime and improves readability. You could replace the docblock with:

-/**
- * @final
- */
-class UnimplementedException extends GRPCException
+final class UnimplementedException extends GRPCException

Afterward, you may remove the redundant PHPDoc block. Also, please verify that all other exception classes in src/Exception/ are consistently declared final.

src/Exception/UnauthenticatedException.php (1)

9-11: Enhance immutability with the final keyword (or correct Psalm tag).
Currently a generic @final docblock is used to signal to static analyzers that this class shouldn’t be extended. For stronger, language-level enforcement, declare the class as final:

-/**
- * @final
- */
-class UnauthenticatedException extends InvokeException
+final class UnauthenticatedException extends InvokeException

If the intent is purely to satisfy Psalm, consider using the @psalm-final annotation instead of the generic @final.

src/Exception/NotFoundException.php (1)

9-13: Optional: Enforce Finality at Runtime
The @final annotation is only enforced by static analysis tools. To prevent subclassing at runtime as well, consider adding the final keyword to the class declaration.

-class NotFoundException extends InvokeException
+final class NotFoundException extends InvokeException
src/Exception/ServiceException.php (1)

9-11: Marking ServiceException as final for static analysis
The PHPDoc @final annotation prevents extending this exception in static analysis tools (e.g. Psalm). If you want to enforce finality at runtime, consider adding the final keyword to the class declaration.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between fb627f2 and 9f289e7.

📒 Files selected for processing (11)
  • composer.json (1 hunks)
  • src/Context.php (3 hunks)
  • src/Exception/GRPCException.php (2 hunks)
  • src/Exception/GRPCExceptionInterface.php (1 hunks)
  • src/Exception/NotFoundException.php (1 hunks)
  • src/Exception/ServiceException.php (1 hunks)
  • src/Exception/UnauthenticatedException.php (1 hunks)
  • src/Exception/UnimplementedException.php (1 hunks)
  • src/Invoker.php (1 hunks)
  • src/ResponseHeaders.php (1 hunks)
  • src/ResponseTrailers.php (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (6)
src/Invoker.php (4)
src/Exception/GRPCException.php (3)
  • Override (56-60)
  • Override (65-69)
  • Override (71-75)
src/Context.php (9)
  • Override (21-28)
  • Override (30-34)
  • Override (36-40)
  • Override (42-54)
  • Override (56-62)
  • Override (64-70)
  • Override (72-78)
  • Override (80-84)
  • Override (86-90)
src/ResponseHeaders.php (2)
  • Override (49-53)
  • Override (55-59)
src/ResponseTrailers.php (2)
  • Override (49-53)
  • Override (55-59)
src/Exception/GRPCExceptionInterface.php (5)
src/Exception/GRPCException.php (3)
  • Override (56-60)
  • Override (65-69)
  • Override (71-75)
src/Context.php (9)
  • Override (21-28)
  • Override (30-34)
  • Override (36-40)
  • Override (42-54)
  • Override (56-62)
  • Override (64-70)
  • Override (72-78)
  • Override (80-84)
  • Override (86-90)
src/ResponseHeaders.php (2)
  • Override (49-53)
  • Override (55-59)
src/ResponseTrailers.php (1)
  • Override (49-53)
src/Invoker.php (1)
  • Override (19-41)
src/ResponseHeaders.php (2)
src/Context.php (9)
  • Override (21-28)
  • Override (30-34)
  • Override (36-40)
  • Override (42-54)
  • Override (56-62)
  • Override (64-70)
  • Override (72-78)
  • Override (80-84)
  • Override (86-90)
src/ResponseTrailers.php (2)
  • Override (49-53)
  • Override (55-59)
src/ResponseTrailers.php (2)
src/Context.php (9)
  • Override (21-28)
  • Override (30-34)
  • Override (36-40)
  • Override (42-54)
  • Override (56-62)
  • Override (64-70)
  • Override (72-78)
  • Override (80-84)
  • Override (86-90)
src/ResponseHeaders.php (2)
  • Override (49-53)
  • Override (55-59)
src/Exception/GRPCException.php (5)
src/Context.php (9)
  • Override (21-28)
  • Override (30-34)
  • Override (36-40)
  • Override (42-54)
  • Override (56-62)
  • Override (64-70)
  • Override (72-78)
  • Override (80-84)
  • Override (86-90)
src/ResponseHeaders.php (2)
  • Override (49-53)
  • Override (55-59)
src/ResponseTrailers.php (2)
  • Override (49-53)
  • Override (55-59)
src/Invoker.php (1)
  • Override (19-41)
src/Exception/MutableGRPCExceptionInterface.php (1)
  • setDetails (16-16)
src/Context.php (4)
src/Exception/GRPCException.php (3)
  • Override (56-60)
  • Override (65-69)
  • Override (71-75)
src/ResponseHeaders.php (2)
  • Override (49-53)
  • Override (55-59)
src/ResponseTrailers.php (2)
  • Override (49-53)
  • Override (55-59)
src/ContextInterface.php (2)
  • getValue (27-27)
  • getValues (34-34)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: psalm / PHP 8.3-ubuntu-latest
🔇 Additional comments (11)
src/Exception/NotFoundException.php (1)

9-11: Docblock @final Annotation Approved
The PHPDoc @final tag correctly marks this exception as final for static analysis, matching the other exception classes in this directory.

composer.json (1)

48-48: Expanded RoadRunner version constraint
The requirement for "spiral/roadrunner" was updated from ^2024.3 to ^2024.3 || ^2025.1. Ensure that your composer.lock is updated and validate compatibility with RoadRunner 2025.1 by running the full test suite.

src/Invoker.php (1)

19-23: Explicit override attribute on invoke()
The #[\Override] attribute clearly denotes that invoke() is overriding a method from InvokerInterface, mirroring similar annotations in other classes for consistency.

src/Exception/GRPCExceptionInterface.php (1)

21-22: Combining ReturnTypeWillChange and Override
Applying #[\ReturnTypeWillChange, \Override] correctly suppresses deprecation warnings and documents that getCode() implements the interface contract. This follows the established pattern across the codebase.

src/ResponseHeaders.php (2)

49-53: Explicit override attribute on getIterator()
Adding #[\Override] makes it clear this method implements IteratorAggregate::getIterator(), improving readability and consistency.


55-59: Explicit override attribute on count()
Adding #[\Override] makes it clear this method implements Countable::count(), improving readability and consistency.

src/ResponseTrailers.php (1)

49-53: Override attribute on IteratorAggregate & Countable methods

The #[\Override] annotations on getIterator() and count() explicitly mark these methods as implementations of the \IteratorAggregate and \Countable interfaces, in line with the project-wide convention.

Also applies to: 55-59

src/Exception/GRPCException.php (1)

56-60: Override attribute on exception detail methods

Annotating getDetails(), setDetails(), and addDetails() with #[\Override] correctly indicates they implement the corresponding interface methods, ensuring consistency and clarity across the exception hierarchy.

Also applies to: 65-69, 71-75

src/Context.php (3)

21-28: Override attribute on ContextInterface methods

The addition of #[\Override] to withValue(), getValue(), and getValues() accurately marks these methods as implementations of ContextInterface, matching the override patterns applied elsewhere.

Also applies to: 30-34, 36-40


42-54: Override attribute on ArrayAccess methods

Marking offsetExists(), offsetGet(), offsetSet(), and offsetUnset() with #[\Override] clearly denotes they fulfill the ArrayAccess contract, maintaining consistency across the codebase.

Also applies to: 56-62, 64-70, 72-78


80-84: Override attribute on IteratorAggregate & Countable methods

Annotating getIterator() and count() with #[\Override] follows the same convention used in other classes for traversable and countable implementations.

Also applies to: 86-90

@roxblnfk roxblnfk merged commit 916c061 into roadrunner-php:3.x May 18, 2025
6 checks passed
@okorneliuk okorneliuk deleted the patch-3 branch May 27, 2025 18:15
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