Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ServiceException to PHPDoc #21

Merged
merged 1 commit into from
Dec 21, 2023
Merged

Add ServiceException to PHPDoc #21

merged 1 commit into from
Dec 21, 2023

Conversation

msmakouz
Copy link
Member

@msmakouz msmakouz commented Dec 21, 2023

Q A
Bugfix?
Breaks BC?
New feature?
Issues roadrunner-php/issues#12

What was changed

  1. The missing Spiral\Goridge\RPC\Exception\ServiceException has been added to the PHPDoc. It is thrown in this method:
    https://github.com/roadrunner-php/goridge/blob/4.x/src/RPC/RPC.php#L101
  2. In the Psalm GitHub Action, the PHP version has been updated to 8.3. In the PHPUnit GitHub Action, the PHP versions have been removed to use the default versions (8.1-8.3)

@msmakouz msmakouz self-assigned this Dec 21, 2023
Copy link

coderabbitai bot commented Dec 21, 2023

Walkthrough

The project's continuous integration workflows have been updated to reflect changes in PHP version support, with PHPUnit configuration no longer specifying PHP 8.1 and 8.2, and Psalm now targeting PHP 8.3. Additionally, the RPCInterface has been enhanced to explicitly handle ServiceException, indicating a refined error handling strategy in remote procedure calls.

Changes

File Summary
.github/workflows/phpunit.yml Removed specifications for PHP versions 8.1 and 8.2.
.github/workflows/.../psalm.yml Updated to use PHP version 8.3.
src/RPC/RPCInterface.php Added ServiceException handling to the call method.

🐇✨
Code hops along, versions leap,
A rabbit's watch, no bugs to keep.
With each commit, a cleaner sweep,
In the warren, code does not sleep. 🌟
🐇💻

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d955f58) 70.52% compared to head (9b39f8b) 70.52%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##                4.x      #21   +/-   ##
=========================================
  Coverage     70.52%   70.52%           
  Complexity      120      120           
=========================================
  Files             9        9           
  Lines           302      302           
=========================================
  Hits            213      213           
  Misses           89       89           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d955f58 and 9b39f8b.
Files selected for processing (3)
  • .github/workflows/phpunit.yml (1 hunks)
  • .github/workflows/psalm.yml (1 hunks)
  • src/RPC/RPCInterface.php (2 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/phpunit.yml
Additional comments: 3
.github/workflows/psalm.yml (1)
  • 17-17: The PHP version for Psalm static analysis has been updated to 8.3. Ensure that this version is compatible with all dependencies and does not introduce any issues with the existing codebase.
Verification successful

The update to PHP 8.3 in the Psalm GitHub Action workflow is compatible with Psalm's requirement for PHP version >=8.1, as indicated in its composer.json. However, the attempt to run Psalm to check for new issues was not successful due to the environment setup. It is recommended to run Psalm in the actual codebase environment to ensure no new issues are introduced with PHP 8.3.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that Psalm supports PHP 8.3 and no issues are introduced by this change.
# Check Psalm's composer.json for PHP version support.
rg '"php":' $(fd composer.json --exec grep -l "psalm/psalm")
# Run Psalm to ensure no new issues are introduced with PHP 8.3.
./vendor/bin/psalm

Length of output: 213

src/RPC/RPCInterface.php (2)
  • 9-9: The use statement for ServiceException has been added correctly. This change will help developers understand the exceptions that the call method can throw.

  • 35-35: The PHPDoc for the call method has been updated to include @throws ServiceException. This update is important for developers to be aware of the exceptions that can be thrown by this method. Ensure that this update is reflected in the documentation and that the ServiceException is indeed thrown by the call method.

Verification successful

The search for occurrences of ServiceException being thrown in the codebase has yielded a result in src/RPC/RPC.php. This confirms that the ServiceException is indeed thrown within the codebase, specifically in the RPC class. This supports the update made in the PHPDoc for the call method in RPCInterface.php, which now includes @throws ServiceException to inform developers of this potential exception.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the `call` method can throw `ServiceException`.
ast-grep --lang php --pattern $'class $_ {
  $$$
  function call($_, $_, $_) {
    $$$
    throw new ServiceException($_);
    $$$
  }
  $$$
}'

Length of output: 251



Script:

#!/bin/bash
# Search for the pattern where `ServiceException` is thrown within the `call` method in PHP files.
rg --type php 'function call\(' -A 10 | rg 'throw new ServiceException'

Length of output: 73



Script:

#!/bin/bash
# Search for any occurrence of `ServiceException` being thrown in the entire codebase.
rg --type php 'throw new ServiceException'

Length of output: 144

@rustatian rustatian added the enhancement New feature or request label Dec 21, 2023
@msmakouz msmakouz merged commit a5d6744 into 4.x Dec 21, 2023
7 checks passed
@msmakouz msmakouz deleted the improvements/exception branch December 21, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants