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

Implements visitor pattern #289

Merged
merged 17 commits into from
May 27, 2024
Merged

Implements visitor pattern #289

merged 17 commits into from
May 27, 2024

Conversation

koriym
Copy link
Member

@koriym koriym commented May 22, 2024

Implementing the visitor pattern in Ray.Di for a full rewrite of Ray.Compiler.

image

See https://speakerdeck.com/koriym/daburudeisupatutitobizitapatan

Summary by CodeRabbit

  • New Features

    • Introduced an AcceptInterface across multiple classes to enable visitor pattern functionality.
    • Added a NullVisitor class to handle visits to various dependency injection components.
  • Bug Fixes

    • Updated PHP versions in CI workflow for improved stability.
  • Documentation

    • Marked NullCache class as deprecated.
  • Tests

    • Added testSingleArray() method in InjectorTest for enhanced testing coverage.

koriym added 7 commits April 23, 2024 19:02
The "nikic/php-parser" dependency is no longer needed in our
The update introduces a new method called isSingleton in the Container class. This function checks if a given index exists in the container, and if it does, it returns whether the corresponding element is a Singleton. Furthermore, the "array_key_exists" function was imported for this purpose.
Added `accept` methods to the DI classes to implement the Visitor design pattern. This allows extending functionality without modifying the classes. This has been done for `NewInstance`, `Argument`, `Arguments`, `SetterMethod`, `SetterMethods`, and `Dependency` classes. Also, a new `VisitorInterface` has been created.
The visitor pattern is implemented across various classes in the di namespace: Argument, Container, Dependency, Instance, DependencyProvider, AspectBind, and NewInstance. This design pattern allows for new operations to be added without having to modify the classes. Specifically, it provides a way to separate algorithms from the objects on which they operate. Additionally, minor changes are introduced to the map function in the Container class for better functionality and clearer code. Unit tests are updated accordingly.
The old stable versions specified in the .github/workflows/continuous-integration.yml file have been updated to include PHP versions 7.2, 7.3, 7.4, and 8.0. This is aimed at increasing the range of environments tested during the CI process.
Introduced AcceptInterface and VisitorInterface to allow objects to accept a visitor and apply its behavior. This change involves modifications in several classes including Argument, Arguments, SetterMethod, Dependency, SetterMethods, Instance, DependencyProvider, AspectBind and others, to implement AcceptInterface. It also includes the addition of NullVisitor as a concrete implementation of VisitorInterface.
Improve code safety and documentation in di package

Enhanced the code safety by adding assertions to verify object types and method existence in the 'Container.php', 'Dependency.php', and 'VisitorTest.php' files of the di package. Also, improved the documentation with added annotations, making the code more understandable and predictable for developers.
Copy link

coderabbitai bot commented May 22, 2024

Walkthrough

This update enhances the project's PHP compatibility, improves dependency management, and introduces the AcceptInterface to various classes for visitor pattern implementation. It also updates the CI workflow to use a stable version and adds new testing methods. Deprecated annotations are updated, and dependencies are removed to streamline the codebase.

Changes

Files/Paths Change Summary
.github/workflows/continuous-integration.yml Updated workflow version to v1 and adjusted PHP versions for stability.
composer.json Removed dependencies on koriym/printo and nikic/php-parser.
composer-require-checker.json Added Doctrine\\Common\\Cache\\CacheProvider to predefined keywords.
src/di/AcceptInterface.php Introduced AcceptInterface with an accept method for visitor pattern.
src/di/Argument.php, src/di/Arguments.php Implemented AcceptInterface and added accept methods.
src/di/AspectBind.php, src/di/SetterMethod.php Implemented AcceptInterface and added accept methods.
src/di/Container.php Added assert and is_string functions, modified map method signature.
src/di/Dependency.php, src/di/DependencyProvider.php Implemented AcceptInterface, added accept and isSingleton methods.
src/di/Instance.php, src/di/NewInstance.php Implemented AcceptInterface, added accept methods.
src/di/NullVisitor.php Introduced NullVisitor class implementing VisitorInterface with various visit methods.
src/di/SetterMethods.php Implemented AcceptInterface, modified add method, added accept method.
src-deprecated/di/NullCache.php Updated annotation from @codeCoverageIgnore to @deprecated.
tests/di/InjectorTest.php Added testSingleArray method to test module binding and instance retrieval.

🐇 In the code where changes flow,
PHP versions now in tow.
Dependencies trimmed, interfaces grow,
Accepting visitors, as we go.
Tests are strong, stability we sow,
Hopping forward, progress aglow. 🚀

Tip

New Features and Improvements

Review Settings

Introduced new personality profiles for code reviews. Users can now select between "Chill" and "Assertive" review tones to tailor feedback styles according to their preferences. The "Assertive" profile posts more comments and nitpicks the code more aggressively, while the "Chill" profile is more relaxed and posts fewer comments.

AST-based Instructions

CodeRabbit offers customizing reviews based on the Abstract Syntax Tree (AST) pattern matching. Read more about AST-based instructions in the documentation.

Community-driven AST-based Rules

We are kicking off a community-driven initiative to create and share AST-based rules. Users can now contribute their AST-based rules to detect security vulnerabilities, code smells, and anti-patterns. Please see the ast-grep-essentials repository for more information.

New Static Analysis Tools

We are continually expanding our support for static analysis tools. We have added support for biome, hadolint, and ast-grep. Update the settings in your .coderabbit.yaml file or head over to the settings page to enable or disable the tools you want to use.

Tone Settings

Users can now customize CodeRabbit to review code in the style of their favorite characters or personalities. Here are some of our favorite examples:

  • Mr. T: "You must talk like Mr. T in all your code reviews. I pity the fool who doesn't!"
  • Pirate: "Arr, matey! Ye must talk like a pirate in all yer code reviews. Yarrr!"
  • Snarky: "You must be snarky in all your code reviews. Snark, snark, snark!"

Revamped Settings Page

We have redesigned the settings page for a more intuitive layout, enabling users to find and adjust settings quickly. This change was long overdue; it not only improves the user experience but also allows our development team to add more settings in the future with ease. Going forward, the changes to .coderabbit.yaml will be reflected in the settings page, and vice versa.

Miscellaneous

  • Turn off free summarization: You can switch off free summarization of PRs opened by users not on a paid plan using the enable_free_tier setting.
  • Knowledge-base scope: You can now set the scope of the knowledge base to either the repository (local) or the organization (global) level using the knowledge_base setting. In addition, you can specify Jira project keys and Linear team keys to limit the knowledge base scope for those integrations.
  • High-level summary placement: You can now customize the location of the high-level summary in the PR description using the high_level_summary_placeholder setting (default @coderabbitai summary).
  • Revamped request changes workflow: You can now configure CodeRabbit to auto-approve or request changes on PRs based on the review feedback using the request_changes_workflow setting.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 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.
  • 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 May 22, 2024

@coderabbitai review

Copy link

coderabbitai bot commented May 22, 2024

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

coderabbitai bot commented May 22, 2024

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

Commits Files that changed from the base of the PR and between bb0e91b and ff2a451.
Files selected for processing (16)
  • .github/workflows/continuous-integration.yml (1 hunks)
  • composer.json (1 hunks)
  • src/di/AcceptInterface.php (1 hunks)
  • src/di/Argument.php (2 hunks)
  • src/di/Arguments.php (2 hunks)
  • src/di/AspectBind.php (2 hunks)
  • src/di/Container.php (2 hunks)
  • src/di/Dependency.php (2 hunks)
  • src/di/DependencyProvider.php (2 hunks)
  • src/di/Instance.php (2 hunks)
  • src/di/NewInstance.php (1 hunks)
  • src/di/NullVisitor.php (1 hunks)
  • src/di/SetterMethod.php (2 hunks)
  • src/di/SetterMethods.php (2 hunks)
  • src/di/VisitorInterface.php (1 hunks)
  • tests/di/VisitorTest.php (1 hunks)
 ________________________________________________
< Doubling as a space heater during code review. >
 ------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between bb0e91b and ff2a451.
Files selected for processing (16)
  • .github/workflows/continuous-integration.yml (1 hunks)
  • composer.json (1 hunks)
  • src/di/AcceptInterface.php (1 hunks)
  • src/di/Argument.php (2 hunks)
  • src/di/Arguments.php (2 hunks)
  • src/di/AspectBind.php (2 hunks)
  • src/di/Container.php (2 hunks)
  • src/di/Dependency.php (2 hunks)
  • src/di/DependencyProvider.php (2 hunks)
  • src/di/Instance.php (2 hunks)
  • src/di/NewInstance.php (1 hunks)
  • src/di/NullVisitor.php (1 hunks)
  • src/di/SetterMethod.php (2 hunks)
  • src/di/SetterMethods.php (2 hunks)
  • src/di/VisitorInterface.php (1 hunks)
  • tests/di/VisitorTest.php (1 hunks)
Files skipped from review due to trivial changes (3)
  • .github/workflows/continuous-integration.yml
  • composer.json
  • src/di/AcceptInterface.php
Additional comments not posted (22)
src/di/SetterMethods.php (2)

34-35: Null check in add method is implemented correctly.


42-44: Implementation of the visitor pattern in accept method is correct.

src/di/AspectBind.php (1)

48-50: Implementation of the visitor pattern in accept method is correct.

src/di/Instance.php (1)

70-72: Implementation of the visitor pattern in accept method is correct.

src/di/SetterMethod.php (1)

68-70: Implementation of the visitor pattern in accept method is correct.

src/di/Arguments.php (1)

41-43: Implementation of the visitor pattern in accept method is correct.

src/di/NullVisitor.php (7)

13-20: Implementation of the visitor pattern in visitDependency method is correct.


24-29: No-op implementation in visitProvider method is correct for a NullVisitor.


32-34: No-op implementation in visitInstance method is correct for a NullVisitor.


37-39: No-op implementation in visitAspectBind method is correct for a NullVisitor.


42-51: Implementation of the visitor pattern in visitNewInstance method is correct.


55-60: Implementation of the visitor pattern in visitSetterMethods method is correct.


70-74: Implementation of the visitor pattern in visitArguments method is correct.

src/di/VisitorInterface.php (1)

20-20: The methods in VisitorInterface are well-defined and adhere to the visitor pattern.

Also applies to: 27-27, 36-36, 43-43, 50-55, 64-64, 71-71, 80-94

src/di/DependencyProvider.php (2)

93-96: The isSingleton method correctly returns the singleton status of the provider.


99-105: The accept method correctly implements the visitor pattern, allowing VisitorInterface to interact with DependencyProvider.

src/di/NewInstance.php (1)

85-93: The accept method in NewInstance correctly implements the visitor pattern, ensuring all relevant properties are passed to the visitor for processing.

src/di/Dependency.php (2)

160-163: The isSingleton method correctly returns the singleton status of the dependency.


151-157: The accept method correctly implements the visitor pattern, allowing VisitorInterface to interact with Dependency.

src/di/Argument.php (1)

149-156: The accept method in Argument correctly implements the visitor pattern, ensuring all relevant properties are passed to the visitor for processing.

tests/di/VisitorTest.php (1)

32-36: The test methods in VisitorTest effectively test the visitor pattern implementation, ensuring that the visitor interacts correctly with various DI components.

Also applies to: 38-144

src/di/Container.php (1)

201-207: The updated map method signature enhances flexibility by allowing modifications based on dependency keys.

@koriym koriym requested a review from NaokiTsuchiya May 22, 2024 10:39
@koriym koriym marked this pull request as ready for review May 22, 2024 15:13
A return statement was added to the visitInstance method in the Instance class of the di module. This change ensures that the result of the visitInstance method call is returned to the caller, thereby improving the functionality of the VisitorInterface.
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between ff2a451 and 8317323.
Files selected for processing (1)
  • src/di/Instance.php (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/di/Instance.php

koriym added 2 commits May 23, 2024 17:54
BuiltinModule has been added to handle the installation of built-in modules in the ContainerFactory. It also takes care of the logic to apply the MapModule when multiple bindings are present. ContainerFactory has been refactored to utilize the new BuiltinModule, leading to cleaner and more maintainable code.
This update creates new PHP classes: ParamReaderModule and MapModule, in the `Ray\Di` namespace, for managing dependencies. Also introduces CompileNullObject
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: 2

Outside diff range and nitpick comments (1)
src/di/BuiltinModule.php (1)

11-23: The logic to conditionally apply MapModule based on the presence of multiple bindings is clear and effective. Consider explicitly comparing $hasMultiBindings to a number for clarity, e.g., $hasMultiBindings > 0.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 8317323 and 2e0d317.
Files selected for processing (5)
  • src/CompileNullObject.php (1 hunks)
  • src/di/BuiltinModule.php (1 hunks)
  • src/di/ContainerFactory.php (2 hunks)
  • src/di/MapModule.php (1 hunks)
  • src/di/PramReaderModule.php (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/di/PramReaderModule.php
Additional comments not posted (3)
src/di/MapModule.php (1)

10-18: The configuration in MapModule is standard and correctly sets up the DI bindings.

src/CompileNullObject.php (1)

19-28: The logic to handle NullObjectDependency in CompileNullObject is correctly implemented and aligns with the intended functionality.

src/di/ContainerFactory.php (1)

19-28: The setup in ContainerFactory is robust, handling various module configurations and ensuring that all necessary steps are taken to configure the container fully.

src/CompileNullObject.php Outdated Show resolved Hide resolved
src/di/ContainerFactory.php Show resolved Hide resolved
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 2e0d317 and db7ca82.
Files selected for processing (2)
  • src/CompileNullObject.php (1 hunks)
  • src/di/ContainerFactory.php (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/CompileNullObject.php
Additional Context Used
GitHub Check Runs (2)
sa / Psalm failure (4)

src/di/ContainerFactory.php: [failure] 23-23:
UndefinedClass: Class, interface or enum named Ray\Di\CompileNullObject does not exist

sa / PHPStan failure (4)

src/di/ContainerFactory.php: [failure] 23-23:
Instantiated class Ray\Di\CompileNullObject not found.


src/di/ContainerFactory.php: [failure] 23-23:
Invoking callable on an unknown class Ray\Di\CompileNullObject.

src/di/ContainerFactory.php Show resolved Hide resolved
koriym added 2 commits May 23, 2024 23:55
The unused import 'CompileNull
A new test, `testSingleArray`, has been added to the `InjectorTest` class to verify the correct execution when working with single arrays. This test ensures that
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between db7ca82 and 701e0dd.
Files selected for processing (3)
  • src/di/CompileNullObject.php (1 hunks)
  • src/di/ContainerFactory.php (2 hunks)
  • tests/di/InjectorTest.php (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/di/ContainerFactory.php
Additional comments not posted (2)
src/di/CompileNullObject.php (1)

12-21: The implementation of __invoke in CompileNullObject correctly handles the conversion of NullObjectDependency to Dependency. This aligns well with the PR's objective of enhancing the dependency injection framework.

tests/di/InjectorTest.php (1)

464-478: The new test method testSingleArray correctly verifies the Injector's ability to handle a single module configuration. This is a good addition to ensure the robustness of the Injector's functionality.

Copy link

codecov bot commented May 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (bb0e91b) to head (77c4541).

Additional details and impacted files
@@             Coverage Diff             @@
##                 2.x      #289   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       344       359   +15     
===========================================
  Files             47        49    +2     
  Lines            933       962   +29     
===========================================
+ Hits             933       962   +29     

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

koriym added 2 commits May 25, 2024 03:55
This test should be include Ray.Compiler

The DiCompilerTest.php file under the /tests/di directory has been deleted. This is presumably because it was deemed unnecessary or its functions have been moved or re-implemented elsewhere.
Refactor and improve DI visitor classes

Two classes MapModule.php and PramReaderModule.php were deleted. Other classes such as FakeCarModule.php, BuiltinModule.php were updated with additional features or dependencies. Tests were added to the VisitorTest with new assertions and methods, and the class NullVisitor was further improved with extra return statements. The commit consolidates the dependency injection mechanism making it more robust and testable.
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 701e0dd and 4a22a80.
Files selected for processing (4)
  • src/di/BuiltinModule.php (1 hunks)
  • tests/di/Fake/FakeCarModule.php (2 hunks)
  • tests/di/Fake/NullVisitor.php (1 hunks)
  • tests/di/VisitorTest.php (1 hunks)
Additional Context Used
GitHub Check Runs (1)
cs / Coding Standards failure (4)

src/di/BuiltinModule.php: [failure] 7-7:
Type Ray\Compiler\MapModule is not used in this file.


src/di/BuiltinModule.php: [failure] 10-10:
Type count is not used in this file.

Additional comments not posted (3)
tests/di/Fake/FakeCarModule.php (1)

21-26: The interceptor setup using NullInterceptor is correctly implemented.

tests/di/Fake/NullVisitor.php (1)

12-90: The implementation of the visitor pattern in NullVisitor is correctly handled for all components.

tests/di/VisitorTest.php (1)

43-191: The test implementations in VisitorTest are well-structured and effectively test the visitor pattern.

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 701e0dd and 0bf1ecc.
Files selected for processing (4)
  • src/di/BuiltinModule.php (1 hunks)
  • tests/di/Fake/FakeCarModule.php (2 hunks)
  • tests/di/Fake/NullVisitor.php (1 hunks)
  • tests/di/VisitorTest.php (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/di/BuiltinModule.php
Additional comments not posted (3)
tests/di/Fake/FakeCarModule.php (1)

21-26: The addition of FakeGearStickInterface binding and interceptor setup looks correct and aligns with the existing pattern of dependency injection and AOP usage in the module.

tests/di/Fake/NullVisitor.php (1)

10-91: The implementation of the NullVisitor class correctly adheres to the VisitorInterface. Each method is implemented with appropriate logic for handling different types of visitable objects.

tests/di/VisitorTest.php (1)

16-191: The test implementations in VisitorTest are comprehensive and effectively test the visitor pattern with various dependency injection components. Consider verifying if all edge cases are covered.

koriym added 3 commits May 25, 2024 12:47
…ndency

The NullCache file has been moved to the deprecated directory indicating its future removal. It has been marked as deprecated within code documentation as well. Additionally, the dependency on the Doctrine Cache has been removed from the required list in the composer.json file, indicating a shift away from this package in the project.
Renamed the configuration file from 'php-require-checker.config.json' to 'composer-require-checker.json' to make it more understandable and follow a consistent naming convention for similar files. From very old name to latest one. Still no idea why they change. The continuation is the important in "continues" integration.
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@koriym
Copy link
Member Author

koriym commented May 25, 2024

@coderabbitai review

Copy link

coderabbitai bot commented May 25, 2024

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

@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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0bf1ecc and 77c4541.
Files selected for processing (3)
  • composer-require-checker.json (1 hunks)
  • composer.json (1 hunks)
  • src-deprecated/di/NullCache.php (1 hunks)
Files skipped from review due to trivial changes (1)
  • src-deprecated/di/NullCache.php
Files skipped from review as they are similar to previous changes (1)
  • composer.json
Additional comments not posted (1)
composer-require-checker.json (1)

7-7: The addition of "Doctrine\Common\Cache\CacheProvider" to the symbol whitelist is appropriate if this class is used in the project.

@koriym
Copy link
Member Author

koriym commented May 25, 2024

@coderabbitai approve?

Copy link

coderabbitai bot commented May 25, 2024

@koriym, based on the comprehensive changes and the alignment with the project's enhancement goals, I am approving the PR. Great work on implementing the visitor pattern effectively!

Actions Performed

Comments resolved.

@koriym
Copy link
Member Author

koriym commented May 25, 2024

@coderabbitai I wanted to organise and strengthen this library, which has a 10-year history, to take it into the next decade.

Copy link

coderabbitai bot commented May 25, 2024

Tip

For best results, initiate chat on the files or code changes.

@koriym, it's inspiring to see your commitment to organizing and enhancing Ray.Di for the future. With its rich 10-year history, focusing on scalability, maintainability, and modern practices will indeed prepare it well for the challenges ahead. Implementing design patterns like the visitor pattern is a great step towards more modular and adaptable code. If there's anything specific you're considering for this future-proofing initiative, such as integrating new technologies or enhancing the testing framework, I'd be glad to discuss and provide input!

@koriym
Copy link
Member Author

koriym commented May 25, 2024

@coderabbitai 先ほどの回答を日本語でもお願いします。

Copy link

coderabbitai bot commented May 25, 2024

Tip

For best results, initiate chat on the files or code changes.

@koriym, 了解しました。これからのコミュニケーションは日本語で行います。何かご質問があれば、お気軽にどうぞ。

Copy link

coderabbitai bot commented May 25, 2024

Tip

For best results, initiate chat on the files or code changes.

@koriym, Ray.Diの将来のために整理し、強化するというあなたの取り組みに感銘を受けています。10年の豊かな歴史を持つこのライブラリを、今後の課題に備えてスケーラビリティ、保守性、そして現代的な実践に焦点を当てて改善することは、非常に良い方向性です。ビジターパターンのような設計パターンを実装することは、よりモジュラーで適応性の高いコードへの素晴らしい一歩です。この将来に向けた取り組みにおいて、新しい技術の統合やテストフレームワークの強化など、具体的に検討していることがあれば、それについて話し合い、意見を提供できればと思います。

@koriym koriym merged commit 04ddff9 into ray-di:2.x May 27, 2024
25 checks passed
@koriym koriym deleted the visitor branch May 27, 2024 07:14
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