Skip to content

Add JsonSerializable in Stringify. - #62

Merged
frankdekker merged 2 commits into
123inkt:masterfrom
avgeeklucky:stringify-json
Jan 27, 2026
Merged

Add JsonSerializable in Stringify.#62
frankdekker merged 2 commits into
123inkt:masterfrom
avgeeklucky:stringify-json

Conversation

@avgeeklucky

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings January 27, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for handling JsonSerializable objects in the Stringify utility class. When a JsonSerializable object is passed to the Stringify::value() method, it now returns a string in the format ClassName(json_representation).

Changes:

  • Added JsonSerializable type check in the Stringify::value() method that encodes the object using json_encode()
  • Created MockJsonSerializable test helper class for testing purposes
  • Added test case to verify JsonSerializable objects are stringified correctly

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Stringify.php Adds JsonSerializable import and implements logic to stringify JsonSerializable objects using json_encode with JSON_THROW_ON_ERROR flag
tests/Mock/MockJsonSerializable.php Creates a simple mock class implementing JsonSerializable for testing purposes
tests/Unit/StringifyTest.php Adds test case to verify JsonSerializable objects are properly stringified with expected format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Stringify.php
Comment thread tests/Unit/StringifyTest.php
@frankdekker
frankdekker merged commit 02f143a into 123inkt:master Jan 27, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants