-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Allow listed deprecations to be skipped #37715
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
Comments
What about allowing one to snapshot the current deprecations and use that as a base for next runs? This could be implemented via some option to the SYMFONY_DEPRECATIONS_HELPER |
@nicolas-grekas that does seem an interesting functionality - we could build on top of this to do that. |
yeah, having a baseline file (the name is taken from the phpstan feature) seems interesting. |
See #34496 😊 I also thought about that a while back and found it useful |
…ecation testing (alexpott) This PR was submitted for the master branch but it was squashed and merged into the 5.x branch instead. Discussion ---------- [PhpUnitBridge] Add ability to set a baseline for deprecation testing | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #37715, #34496 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> This PR allows you set new options for `SYMFONY_DEPRECATIONS_HELPER` env var: * `generateBaseline` - if this is set to TRUE any deprecations that occur will be written to the file defined in the `baselineFile` option * `baselineFile` a path to a file that contains a json encoded array of deprecations that will be skipped. ### Questions * If you set `generateBaseline` without also setting `baselineFile` an exception is thrown. We could use a default filename if one is not provided (like PHPStan). * How much error checking should we do around the `baselineFile` variable - should we check if it is readable or should we rely on `file_get_contents`()? ### Still @todo Add proper end-to-end testing using a .phpt test Commits ------- 483236f [PhpUnitBridge] Add ability to set a baseline for deprecation testing
Description
Drupal is using Symfony's PHPUnit bridge to detect usages of deprecated code during tests. This has proved amazing useful in managing our technical debt and has helped us prepare for Symfony 4 and 5. One problem we've faced because of Drupal's size is that it is not always possible to address new deprecations at the same time as upgrading a dependency. In order to handle this we've added the ability to skip specific deprecations which we can then handle in a separate issue.
When skipping a deprecation we can either match the entire message or use a regex for a dynamic deprecation message.
Example
For example, Drupal 9 is using Symfony 4 and we're skipping the
The "Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser" class is deprecated since Symfony 4.3, use "Symfony\Component\Mime\MimeTypes" instead.
deprecation notice and handling the changes we need to make to Drupal in https://www.drupal.org/project/drupal/issues/3055193The text was updated successfully, but these errors were encountered: