-
Notifications
You must be signed in to change notification settings - Fork 29
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
Refactor codebase to use SetStateInterface #237
Conversation
The `_initState` method and its associated annotations were removed as they are no longer used. This simplifies the interface and reduces unnecessary code clutter.
This updates the codebase to use the new SetStateInterface instead of the deprecated WeavedInterface. The changes include interface replacement in method checks, class generation, and documentation adjustments to maintain consistency. A new SetStateInterface is introduced, and relevant bindings are updated accordingly.
Reviewer's Guide by SourceryThis pull request refactors the codebase to use Class diagram for SetStateInterfaceclassDiagram
class SetStateInterface {
<<interface>>
+ _initState(array $bindings): void
}
SetStateInterface -- WeavedInterface : extends
Removed class diagram for WeavedInterfaceclassDiagram
class WeavedInterface {
<<interface>>
// Removed
// + _initState(array $bindings): void
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
WalkthroughThe changes refactor the handling of interface implementations in the AOP code. The modifications switch type checks and method calls from Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant CodeGen as AopCode
participant Compiler as Compiler/Weaver
participant Instance as New Instance
Client->>CodeGen: generate(sourceClass, bind, postfix)
CodeGen->>CodeGen: uses SetStateInterface in generation
Client->>Compiler: newInstance(class, args)
Compiler->>Instance: Instantiate class
Note right of Compiler: If instance instanceof SetStateInterface
alt Instance implements SetStateInterface
Compiler->>Instance: _initState(bindings)
end
Compiler-->>Client: Return initialized instance
Possibly related PRs
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @koriym - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider removing the now-empty
WeavedInterface
file. - Why does
SetStateInterface
extendWeavedInterface
? It seems redundant sinceWeavedInterface
is empty.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
PHPStan flagged an issue with the interface extension. Added an `@phpstan-ignore-line` comment to suppress the warning and maintain compatibility without altering the functionality.
There was a problem hiding this 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
Plan: Pro
📒 Files selected for processing (6)
src/AopCode.php
(1 hunks)src/Compiler.php
(1 hunks)src/InterceptTrait.php
(1 hunks)src/SetStateInterface.php
(1 hunks)src/WeavedInterface.php
(0 hunks)src/Weaver.php
(1 hunks)
💤 Files with no reviewable changes (1)
- src/WeavedInterface.php
✅ Files skipped from review due to trivial changes (1)
- src/InterceptTrait.php
🧰 Additional context used
🪛 PHPStan (2.0.3)
src/SetStateInterface.php
15-15: PHPDoc tag @SuppressWarnings has invalid value ((PHPMD.CamelCaseMethodName)): Unexpected token ".CamelCaseMethodName)", expected ')' at offset 80 on line 4
(phpDoc.parseError)
🔇 Additional comments (4)
src/SetStateInterface.php (1)
9-18
: LGTM! Well-designed interface.The interface is well-designed with:
- Clear extension of WeavedInterface
- Properly typed _initState method
- Comprehensive PHPDoc
🧰 Tools
🪛 PHPStan (2.0.3)
15-15: PHPDoc tag @SuppressWarnings has invalid value ((PHPMD.CamelCaseMethodName)): Unexpected token ".CamelCaseMethodName)", expected ')' at offset 80 on line 4
(phpDoc.parseError)
src/Weaver.php (1)
60-60
: LGTM! Consistent type check update.The type check update to SetStateInterface aligns with the interface refactor while maintaining the existing initialization logic.
src/Compiler.php (1)
67-67
: LGTM! Consistent type check update.The type check update to SetStateInterface aligns with the interface refactor while maintaining the existing initialization logic.
src/AopCode.php (1)
59-59
: LGTM! Consistent interface implementation update.The update to implement SetStateInterface in generated classes aligns with the interface refactor while maintaining the existing code generation logic.
@sourcery-ai Think about the classes that use this. The old class recognizes |
You're right to consider the impact on classes using these interfaces. My initial review focused on the structural changes of the refactoring. Let's clarify the intended behavior with the introduction of If However, if |
@sourcery-ai Smooth expansion is assumed. |
This PR idea has been rejected and will be moved to #238. |
This pull request updates the codebase to use the new SetStateInterface instead of WeavedInterface, including method checks, class generation, and documentation adjustments.
Summary by Sourcery
Enhancements:
SetStateInterface
instead ofWeavedInterface
for managing state in interceptors.Summary by CodeRabbit
New Features
Refactor
Documentation