-
-
Notifications
You must be signed in to change notification settings - Fork 10
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 PreInvoke and PostInvoke events #29
base: 3.x
Are you sure you want to change the base?
Add PreInvoke and PostInvoke events #29
Conversation
WalkthroughIn this update, we replaced the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Invoker
participant EventDispatcher
Client->>Invoker: invoke(Method, Context, Message)
Invoker->>EventDispatcher: dispatch(PreInvokeEvent)
EventDispatcher-->>Invoker: PreInvokeEvent
Invoker->>Invoker: Execute Method
Invoker->>EventDispatcher: dispatch(PostInvokeEvent)
EventDispatcher-->>Invoker: PostInvokeEvent
Invoker-->>Client: Result
Poem
Warning Review ran into problemsProblems (1)
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 as PR comments)
Additionally, you can add CodeRabbit Configration 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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- composer.json (1 hunks)
- src/Event/Event.php (1 hunks)
- src/Event/PostInvokeEvent.php (1 hunks)
- src/Event/PreInvokeEvent.php (1 hunks)
- src/Invoker.php (3 hunks)
Files skipped from review due to trivial changes (1)
- composer.json
Additional comments not posted (9)
src/Event/PostInvokeEvent.php (2)
11-14
: The constructor is correctly defined and ensures immutability of theoutput
property.
16-19
: ThegetOutput()
method is implemented correctly as a straightforward getter for theoutput
property.src/Event/PreInvokeEvent.php (3)
12-16
: The constructor is correctly defined, ensuring immutability and type safety forctx
andinput
properties.
18-21
: ThegetContext()
method is implemented correctly as a straightforward getter for thectx
property.
23-26
: ThegetInput()
method is implemented correctly as a straightforward getter for theinput
property.src/Event/Event.php (2)
16-19
: TheisPropagationStopped()
method correctly implements the interface's requirement to check the event's propagation state.
28-31
: ThestopPropagation()
method is correctly implemented and well-documented, ensuring that event propagation can be halted as required.src/Invoker.php (2)
23-26
: The constructor is well-implemented, providing optional dependency injection forEventDispatcherInterface
, which allows for flexible integration of event handling.
39-40
: The integration ofPreInvokeEvent
andPostInvokeEvent
dispatching in theinvoke
method is correctly implemented, enhancing the invoker's functionality as intended.Also applies to: 46-47
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: 0
@hurricane-voronin Hi, thank you. Regarding the implementation, everything is fine. However, what was your reason for adding |
Hi @msmakouz! |
Hi. Using the decorator pattern you don't need to copy-paste the ton of logic. Just implement the Injector interface and reuse the existing Injector class. |
Summary by CodeRabbit
New Features
Bug Fixes
"spiral/roadrunner-worker"
with"psr/event-dispatcher"
for improved event handling.Chores
MissingClassConstType
issue in thepsalm.xml
configuration for cleaner code analysis.