-
-
Notifications
You must be signed in to change notification settings - Fork 2
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 missing methods from serializer interface #192
base: master
Are you sure you want to change the base?
Add missing methods from serializer interface #192
Conversation
@lotyp please review |
@coderabbitai review |
Actions performedReview triggered.
|
WalkthroughRecent updates have enhanced the Changes
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 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: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/Contracts/SerializerInterface.php (1 hunks)
- src/Serializer.php (2 hunks)
- src/SerializerManager.php (2 hunks)
Files skipped from review due to trivial changes (1)
- src/Serializer.php
Additional comments not posted (4)
src/Contracts/SerializerInterface.php (2)
17-26
: Thenormalize
method now includes a detailed return type and athrows
declaration. Ensure that all implementations of this interface handle the potential exceptions as documented.
28-28
: The addition ofdenormalize
,supportsNormalization
,supportsDenormalization
,encode
,decode
,supportsEncoding
, andsupportsDecoding
methods are well-defined and adhere to the interface segregation principle, ensuring that the interface remains specific to client's needs.Also applies to: 32-32, 34-34, 36-36, 38-38, 40-40
src/SerializerManager.php (2)
7-7
: The use ofArrayObject
andStringable
is appropriate here given the context and usage in method signatures.
37-37
: The implementation of the new methods (denormalize
,supportsNormalization
,supportsDenormalization
,encode
,decode
,supportsEncoding
,supportsDecoding
) inSerializerManager
properly delegates functionality to the serializer retrieved based on the format. This promotes single responsibility and adheres to the open/closed principle. However, ensure that all possible exceptions are handled or documented.Also applies to: 42-47, 49-54, 56-61, 63-68, 70-75, 77-82, 84-88
use ArrayObject; | ||
use Stringable; | ||
use Symfony\Component\Serializer\Exception\ExceptionInterface; |
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.
Consider removing the unused import Symfony\Component\Serializer\Exception\ExceptionInterface
if it is not required in this file.
Hi @michaelcozzolino, 👋 Thank you for your contribution and sorry for the delay in reviewing it. 🙏 I noticed you had an issue with missing methods in the For the 1.x version, you can access the original Symfony Serializer through Laravel's container like this: $serializer = $app->make(\Symfony\Component\Serializer\SerializerInterface); You can find more details in the code here: I am currently doing a big refactor for the 2.x version, which you can follow in this PR: In version 2.x, I have added two new Facades: These Facades let you access the Manager and the already configured original Serializer. I will check your changes and see how the For more details on this change, see: You can also find the test here: Thanks again for your contribution! |
This PR adds methods available in the symfony serializer to the SerializerInterface such as
denormalize
andsupportsDenormalization
and similarSummary by CodeRabbit
New Features
Improvements
normalize
method to specify return type hints and handle additional return types for better flexibility and error handling.