Skip to content

PHPUnitBridge - add a deprecation 'ignoreFile option' to allow silencing deprecation patterns #45223

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

Closed
mondrake opened this issue Jan 28, 2022 · 0 comments · Fixed by #45226
Closed

Comments

@mondrake
Copy link
Contributor

mondrake commented Jan 28, 2022

Description

While working on an attempt to create a deprecation baseline for Drupal, I realised that on top of the baseline file it would be good to have the possibility to skip/silence some deprecation patterns. In a way, similar to what PHPStan is doing, where you can have an errors baseline file + a separate section of ignoreErrors patterns in its configuration file. Then, BOTH when generating a baseline AND when using it, any deprecation matching any pattern from the list should be skipped (i.e. during generation -> not written to the baseline file, during usage -> not reported).

Example

For example (maybe not the best one, but this is one that generates a lot of noise), we have a deprecation triggered within a test listener:

The \"Drupal\\Tests\\Listeners\\DrupalListener\" class uses \"PHPUnit\\Framework\\TestListenerDefaultImplementation\" that is deprecated The 'TestListener' interface is deprecated.

this deprecation would be triggered for every test, and we have thousands. Also, it's a deprecation from PHPUnit, so nothing directly actionable by the Drupal community.

Having an ignoreFile option indicating a file that lists patterns of deprecations to be silenced like

SYMFONY_DEPRECATIONS_HELPER='generateBaseline=true&baselineFile=./tests/allowed.json&ignoreFile=./tests/ignored.json'
would do.

nicolas-grekas added a commit that referenced this issue Mar 31, 2022
… file that lists deprecation messages to ignore (mondrake)

This PR was squashed before being merged into the 6.1 branch.

Discussion
----------

[PhpUnitBridge] Add option `ignoreFile` to configure a file that lists deprecation messages to ignore

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no
| Tickets       | Fix #45223
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too.)
 - Features and deprecations must be submitted against the latest branch.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Commits
-------

2809e40 [PhpUnitBridge] Add option `ignoreFile` to configure a file that lists deprecation messages to ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants