yiisoft / json

JSON encoding and decoding
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
26 stars 8 forks source link

Fix bug with extended DateTime, improve performance #41

Closed Tigrov closed 11 months ago

Tigrov commented 12 months ago

2023-09-09_23-59-38

About jsonSerialize()

The PHP documentation mentions: Returns data which can be serialized by json_encode()

The processObject() should return the result of jsonSerialize() without processing:

return $data->jsonSerialize();

But this breaks BC.

If it is requered to pre-process data for jsonSerialize(), this should be done inside jsonSerialize():

...
public function jsonSerialize(): mixed
{
    return Json:process($this->data);
}
...

What do you think? Do this for the next major version?

Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Fixed issues -
codecov[bot] commented 12 months ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (4b62dd2) 100.00% compared to head (d666c50) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #41 +/- ## =========================================== Coverage 100.00% 100.00% - Complexity 15 20 +5 =========================================== Files 1 1 Lines 31 37 +6 =========================================== + Hits 31 37 +6 ``` | [Files Changed](https://app.codecov.io/gh/yiisoft/json/pull/41?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=yiisoft) | Coverage Δ | | |---|---|---| | [src/Json.php](https://app.codecov.io/gh/yiisoft/json/pull/41?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=yiisoft#diff-c3JjL0pzb24ucGhw) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

what-the-diff[bot] commented 12 months ago

PR Summary