Skip to content

Conversation

@tymondesigns
Copy link
Contributor

@tymondesigns tymondesigns commented Jan 29, 2026

This pull request introduces several improvements and updates across benchmarking, logging, and exception handling, as well as some workflow and configuration changes. The main highlights are the addition of PSR-3 logger support to the JSON repair functions, a new custom exception for invalid JSON after repair, enhancements to benchmarking configuration and coverage, and some workflow simplifications.

Logging and Exception Handling Improvements:

  • Added an optional PSR-3 LoggerInterface parameter to the json_repair and json_repair_decode functions, allowing users to inject a logger for debugging repair actions. The logger is set on the JsonRepairer instance if provided. (src/functions.php, composer.json) [1] [2] [3] [4] [5]
  • Introduced a custom JsonRepairException class, with a static method for reporting when the repair process produces output that is still invalid JSON. (src/Exceptions/JsonRepairException.php)

Benchmarking Enhancements:

  • Added a new benchmark method benchNativeJsonDecodeBaseline to compare the repair overhead against native json_decode on valid JSON. (benchmarks/JsonRepairerBench.php)
  • Adjusted iterations and revisions for benchmarks to reduce runtime and added documentation for large JSON benchmarks. (benchmarks/JsonRepairerBench.php, phpbench.json) [1] [2] [3]
  • Renamed the key in the large JSON provider for clarity. (benchmarks/JsonRepairerBench.php)

Workflow and Configuration Updates:

  • Updated the test workflow to always run tests in parallel and removed the mutation testing step for simplicity. (.github/workflows/run-tests.yml)
  • Added the benchmarks directory to .gitattributes as export-ignore to exclude it from distribution archives. (.gitattributes)
  • Added colinodell/psr-testlogger as a dev dependency for testing logger integration. (composer.json)

@tymondesigns tymondesigns marked this pull request as ready for review January 29, 2026 11:33
@tymondesigns tymondesigns merged commit 7119373 into main Jan 29, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants