Repository navigation
Keep the PHP warning text in exceptions raised from an error - #99
Merged
Merged
Conversation
initializeFromError() passed the error number as the message and the warning text, cast to int, as the code. Pass them in the constructor's order, and throw static so IOException no longer needs its own copy. Fixes #91 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IOException/ParseException raised from a PHP warning lose the warning text — message is the error number
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #99 +/- ##
============================================
+ Coverage 89.84% 90.32% +0.48%
+ Complexity 1430 1429 -1
============================================
Files 26 25 -1
Lines 3189 3184 -5
============================================
+ Hits 2865 2876 +11
+ Misses 324 308 -16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #91
ParseException::initializeFromError()passed its arguments to the constructor in the wrong order, so an exception raised from a PHP warning had the error number as its message (2 (/path/to/src/DOMQuery.php: 1343)) and0as its code. It now throwsnew static($errstr, $errno, $errfile, $errline), and the identical override inIOExceptionis removed, sincestaticalready gives the right class.This changes the exception message, so the CHANGELOG entry warns anyone matching on the old text.
Tests:
testFailedParseReportsWarningandtestFailWriteXMLReportsWarningcheck that the message contains the warning text and that the code isE_WARNING. Both fail onmain.🤖 Generated with Claude Code