chore: Let PHPUnit convert deprecations to errors #243
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.
Changes PHPUnit config to:
Note that due to PHPUnits way of parsing warnings, not all deprecations may lead to errors.
The Issue
Currently, PHPUnit is not properly configured to report deprecation warnings, as noted in #241. This means that while our CI tests pass, they do not catch potential future breakages introduced by deprecated functionality.
Why This Matters
Deprecation warnings:
Given the repository's history of treating deprecations as bugs in maintainer's past comments (PR #177 Review), it makes sense to ensure CI catches these issues proactively.
Limitations & Potential Workarounds
Due to the way PHPUnit 9 handles deprecations, only warnings triggered directly during test execution will cause failures. Deprecations that occur indirectly—such as in constructors of abstract classes—may not be caught if they are invoked through child classes. Since PHPUnit does not detect these deprecations as part of the test execution path, they may go unnoticed.
As all deprecation warnings are printed—only direct warnings trigger errors, one possible workaround is to wrap PHPUnit in a shell script that parses its output, explicitly looking for
"Deprecation:"messages. This approach (or other potential solutions) can be discussed in the comments or in a new issue. I'm happy to implement this or explore alternative suggestions if anyone has ideas.