Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow selected deprecations to be skipped/ignored #5841

Open
mondrake opened this issue May 23, 2024 · 1 comment
Open

Allow selected deprecations to be skipped/ignored #5841

mondrake opened this issue May 23, 2024 · 1 comment
Labels
type/enhancement A new idea that should be implemented

Comments

@mondrake
Copy link

mondrake commented May 23, 2024

symfony/phpunit-bridge used to provide the Ignoring Deprecations feature, by means of which a deprecation error triggered during a test, that matches any pattern from a set defined in an ignore file, would be ignored and not reported.

In Drupal testing, we are making extensive use of this feature, to the point that when we started testing with PHPUnit 10, we developed our own replacement of the functionality.

The logic is that in large codebases with strong BC focus, we may incur in deprecations that would occur in thousands (for example, deprecations thrown by a debug classloader that check proper typehinting of extending classes), and it may be unlikely that fixing them will occur before next major release and/or with a single issue.

So it is much simpler just to ignore them and then remove the ignore pattern once it is no longer necessary.

symfony/phpunit-bridge and Drupal 11 own DeprecationHandler both achieve that by means of heavily replacing PHPUnit's error handler, which works but may not be a good idea long term.

A feature (note, not necessarily a blunt replacement of the ignore file, could be an event validating whether the single deprecation thrown should be ignored, or similar mechanisms) to allow selected deprecations to be skipped/ignored from the reporting, would help to remove those fillgaps.

@mondrake mondrake added the type/enhancement A new idea that should be implemented label May 23, 2024
@sebastianbergmann
Copy link
Owner

The baseline features exists and is, IMHO, good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

2 participants