- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Update Invoker to handle Message objects as input #25
Conversation
Now it can accept both string and Message objects as inputs. This change simplifies the process when the input is already a Message object, eliminating the need to convert it again.
WalkthroughThe Changes
TipsChat with CodeRabbit Bot (
|
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## 3.x #25 +/- ##
============================================
+ Coverage 76.58% 76.67% +0.09%
- Complexity 94 95 +1
============================================
Files 8 8
Lines 252 253 +1
============================================
+ Hits 193 194 +1
Misses 59 59 ☔ View full report in Codecov by Sentry. |
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- src/Invoker.php (3 hunks)
- tests/InvokerTest.php (2 hunks)
Additional comments: 9
src/Invoker.php (4)
17-35: The update to the
invoke
method to handlestring|Message|null
types and the logic to use theMessage
instance directly if provided is a good enhancement for flexibility. Ensure that all usages of this method are updated to handle the new parameter types correctly.51-55: The addition of the comma after the
sprintf
function call in theassertResultType
method is a minor syntax correction for code style consistency.92-96: The addition of the comma after the
sprintf
function call in theassertInputType
method is a minor syntax correction for code style consistency.92-98: The
assertInputType
method correctly checks if the provided class is a subclass ofMessage
, ensuring type safety for the input conversion process.tests/InvokerTest.php (5)
28-29: The summary does not mention the modification in the
testInvoke
method wherepackMessage
is now used instead ofcreateMessage
. This change should be documented to maintain an accurate record of all changes.31-43: The new test
testInvokeWithInputMessage
correctly verifies that theInvoker
can handle aMessage
object as input.46-48: The summary states that the
testInvokeError
method includes additional assertions for the exception message, but the hunk does not show these changes. This inconsistency should be addressed.58-60: The addition of the
packMessage
method is a useful utility for serializingMessage
objects to strings for testing purposes.63-68: The
createMessage
method has been refactored to return aMessage
object, aligning with the new functionality of theInvoker
class to acceptMessage
objects.
Now it can accept both string and Message objects as inputs. This change simplifies the process when the input is already a Message object, eliminating the need to convert it again.
Summary by CodeRabbit
New Features
invoke
method to supportMessage
objects directly.Bug Fixes
assertResultType
andassertInputType
methods.Tests
testInvokeWithInputMessage
to ensure proper handling ofMessage
objects.testInvokeError
with additional assertions for exception handling.packMessage
utility method for test message preparation.createMessage
method to returnMessage
objects for testing purposes.