Problem/Motivation

The new deprecation policy adds an expected format for @deprecation notice (@trigger_error()), read more on https://www.drupal.org/node/2856615. Core should comply.

Proposed resolution

Determine a way to ensure that all @deprecated annotations have a corresponding @trigger_error().

Remaining tasks

User interface changes

API changes

Data model changes

Comments

alexpott created an issue. See original summary.

xjm’s picture

Title: Update @deprecation messages to the new format » [meta] Update @deprecation messages to the new format
Category: Task » Plan
Priority: Normal » Major

Definitely a good way to go about this.

Making this a plan issue because this will require a series of steps starting with the coder rule child issue. Also major, because this is a big part of adopting a much smoother major version upgrade process.

dawehner’s picture

klausi’s picture

What is an @deprecation notice? The @deprecated tag? Or the trigger_error() calls? Can you describe an example in the issue summary what should be changed into what?

dawehner’s picture

Issue summary: View changes
mile23’s picture

Adding @trigger_error() will have to be a case-by-case basis in tandem with removing usage of deprecated code. Contemplate that, for instance, \Drupal::entityManager() is deprecated, but is used extensively by the entity system.

So:

This is basically the same pattern as the CS fixes.

xjm’s picture

@Mile23, so you think that adding @trigger_error() should be done once core usages are removed? I was debating whether there was some way to test conditionally as usages were removed, but that route might make more sense.

mile23’s picture

Well if you look at that CI run you'll see that adding the symfony phpunit bridge fails all tests that use the deprecated code. Here: https://www.drupal.org/pift-ci-job/646796

So 1) Fix the deprecations that allow the bridge to be added without failing, 2) Add the bridge, 3) Start adding @trigger_error() at the same time as you remove usages.

Using the bridge would be the way to test conditionally. If we have the bridge, we can use it to fail usages per triggered error. Sort of like the coding standards stuff.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

larowlan’s picture

Hasn't been much movement here - do we still think automated is the way to go or are we better to crowd-source this?
They make good novice tasks.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mile23’s picture

Just to amend #8: What we did was to add a list of 'allowed' deprecation errors which would be ignored, in order to manage the technical debt. #2870194: Ensure that process-isolated tests can use Symfony's PHPunit bridge to catch usages of deprecated code

We are removing individual messages from the ignore list in #2959269: [meta] Core should not trigger deprecated code except in tests and during updates so they are 'live' and will fail tests.

Estimating ~80 files that have @deprecated but not @trigger_error().

$ grep -lr @trigger_error core/ | wc -l
     267
$ grep -lr @deprecated core/ | wc -l
     344
andypost’s picture

There was ideaof creating deprecated module, so it could maintain a list of deprecated stuff

I see no reason to have a rule in coder module because it willbe a pain to update it on each new deprecation.

The main target is to allow contrib and custom code to scan for deprecated usage (like phpstorm can) but that scan depends on core version used so it doesnot fits in coder module

mile23’s picture

Issue summary: View changes

+1 on #14.

I think there are too many edge cases for how to ensure there's a @trigger_error() using coder. Like, for instance: #2234479: Deprecate hook_test_* hooks in simpletest is weird because we have a special deprecated hook invoker on the module handler.

Updating IS.

gábor hojtsy’s picture

Title: [meta] Update @deprecation messages to the new format » [meta] Adopt trigger_error() for deprecation messages where it is missing

I started head on on #3033332: [META] Fix language and consistency of deprecation messages and annotations which is about fixing the existing text itself. Since this is about adding trigger_error(), let's make the distinction clear.

gábor hojtsy’s picture

Status: Active » Closed (duplicate)
Issue tags: -Needs issue summary update

Reading the discussion and issue summary here, this looks entirely the same as #2856744: [META] Add trigger_error(..., E_USER_DEPRECATED) to deprecated code which is actually making some progress recently. Please reopen and update significantly if this is different in any way.