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

Remove unnecessary singleton scopes and update bindings #157

Merged
merged 6 commits into from
Jan 6, 2025
Merged

Conversation

koriym
Copy link
Member

@koriym koriym commented Jan 6, 2025


Description:

  • Removed unnecessary singleton scopes from several bindings to improve flexibility and lifecycle control.
  • Added a new binding for RefreshSameCommand to enhance functionality.
  • Updated bindings to align with the intended design and improve overall application architecture.

koriym added 5 commits January 6, 2025 09:25
The Scope::SINGLETON binding was removed from the pool configuration to allow for more flexible and dynamic behavior. This change ensures the adapter binding uses default scope settings, aligning with the intended design.
Updated the binding of ResourceStorageInterface to use singleton scope. This ensures a single instance is reused across the application, improving memory efficiency and consistency.
Upgraded multiple dependencies in `composer.lock` to include the latest versions. Updated `CommandsProvider` to replace `QueryRepositoryInterface` and `ResourceInterface` with specific command dependencies for better clarity and modular design.
The binding for UriTagInterface no longer uses singleton scope. This simplifies the dependency lifecycle and allows for more flexible instantiation when needed.
Removed singleton scope from several bindings to allow better flexibility and lifecycle control. Added a new binding for `RefreshSameCommand` to expand functionality.
Copy link
Contributor

coderabbitai bot commented Jan 6, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The pull request introduces significant changes to the dependency injection and command management in the application. The modifications primarily affect three modules: CommandsProvider, DonutCacheModule, and QueryRepositoryModule. The changes involve restructuring how commands are instantiated, removing explicit singleton scopes for certain interfaces, and adding new bindings. The overall impact suggests a refactoring of the application's dependency injection and command handling approach.

Changes

File Change Summary
src/CommandsProvider.php - Constructor now accepts RefreshSameCommand and RefreshAnnotatedCommand instead of repository and resource interfaces
- get() method now returns pre-configured command instances
src/DonutCacheModule.php - Removed singleton scope for UriTagInterface binding
- Default binding now uses transient scope
src/QueryRepositoryModule.php - Removed singleton scope for EtagSetterInterface, NamedParameterInterface, and MatchQueryInterface
- Explicitly added singleton scope for ResourceStorageInterface
- Added new binding for RefreshSameCommand

Possibly related PRs

  • Enable Windows test compat #151: Changes in DonutRepositoryTest related to purge method might have implications for command execution and result handling, potentially connected to the command management modifications in this pull request.

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 your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

@koriym
Copy link
Member Author

koriym commented Jan 6, 2025

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Jan 6, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (5a85523) to head (aaeb79c).
Report is 11 commits behind head on 1.x.

Additional details and impacted files
@@             Coverage Diff             @@
##                 1.x      #157   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       230       231    +1     
===========================================
  Files             51        51           
  Lines            737       738    +1     
===========================================
+ Hits             737       738    +1     

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

Add support for PHP 8.4 in the matrix strategy to ensure compatibility with newer PHP versions. Upgrade the Codecov action to v3 for improved functionality and maintenance. These changes enhance the CI pipeline's robustness and coverage.
@koriym koriym merged commit 1455d3f into 1.x Jan 6, 2025
27 checks passed
@koriym koriym deleted the singleton branch January 6, 2025 11:49
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.

1 participant