Skip to content

Make PHPUnit fail on deprecation errors - #51

Merged
sanmai merged 1 commit into
pear:masterfrom
ttgrules:catch-deprecation-errors
Oct 15, 2025
Merged

sanmai merged 1 commit into
pear:masterfrom
ttgrules:catch-deprecation-errors

Conversation

@ttgrules

Copy link
Copy Markdown
Contributor

This changes the PHPUnit to show Deprecation warnings and convert them to exceptions. This may not be the desired behavior, but it does enable earlier detection and correction of obsolete code in new versions of php.

Prompted by the missing offset class property fixed in #49

@ttgrules

Copy link
Copy Markdown
Contributor Author

You can test this by commenting out any class property and running the unit tests in php8.3+ to see the failure because dynamic class properties were deprecated

@sanmai
sanmai self-requested a review October 15, 2025 09:43

@sanmai sanmai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested, works.

  1. error_reporting=-1 makes PHP report deprecations
  2. convertDeprecationsToExceptions makes PHPUnit convert them to errors

@sanmai
sanmai merged commit e56f7bc into pear:master Oct 15, 2025
13 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.

3 participants