Skip to content

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

@mondrake

Description

@mondrake

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions