Problem/Motivation

The results of running Devel PHPUnit tests with suppress-deprecations: false report the following uses of deprecated code at core 8.9. The total number varies slightly from run to run due to the randomness within the Devel Generate tests.

Date Total deprecation count Deprecation message types
17 November 350
18 November 262 23
20 November 147 19
4 December 100 18
5 December 87 14
22 January 2020 67 11
10 March 64 10
17 March 57 8
18 March 80 7
6 April 42 5

Remaining deprecation notices:

The above notices are reported because the functions and methods have @trigger_error. There are also many uses of deprecated code in Devel which should be corrected but are not shown in the deprecations report above. This is either because they do not have @trigger_error or because there is no code coverage for that part of the module.

For issues reported by D9 drupal-check please use #3127486: Devel deprecations from D9 drupal-check report as the parent issue.

Proposed resolution

Fix deprecations by type or by a group of related functions, which can be covered by individual issues.

Remaining tasks - Process

  1. Determine which of the above notices are not yet covered by child issues
  2. Create the child issue required
  3. When a few child issues have beeen fixed update this issue summary with the reduced numbers
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ChaseOnTheWeb created an issue. See original summary.

salvis’s picture

Does this (and similar postings) make you feel good?

mikelutz’s picture

Respectfully, we've asked the sprint contributors at the Midwest Drupal Camp D9 readiness sprint to provide these reports and open issues for the top 100 modules. They are meant to be a helpful report, and a way for new contributors to get their feet wet in the issue queue. Please feel free to close the issue if you don't find it helpful, but ChaseOnTheWeb and others providing these reports today are not trying to make themselves feel good or be annoying, or game contribution credits, or create issue queue noise. They are doing so to try to contribute and be helpful, and because they've been asked to by the sprint organizers.

moshe weitzman’s picture

Status: Active » Closed (works as designed)

Please open a new issue with patches to fix the highlighted deprecations.

mikelutz’s picture

Status: Closed (works as designed) » Active

The sprint plan was to get the issues open first and then begin to work on patches, where we can, depending on the sprinters skill level. We will remove the devel module from our list.

mikelutz’s picture

Status: Active » Closed (works as designed)

Whoops, I'm sorry. I didn't mean to reopen.

moshe weitzman’s picture

Status: Closed (works as designed) » Active

I'd welcome such patches, so please keep us on the list. Thanks for your work, mikelutz.

salvis’s picture

Ok, thank you for explaining, mikelutz, and thank you for working on this.

The thing is that a report as long as this one, with long monospaced lines wrapped in a narrow column, is completely unusable. It needs to be structured into readable, manageable, and meaningful pieces. Separate things need to be separated out to their own issues (like kint, for example).

Lines like

 ------ -------------------------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------------------------------------- 

need to be pruned. In fact these reports would render much better without <code>. Preview is showing longer lines and the reports don't look too bad, but after saving, the line width is much less and the reports look more like throwing mud over everything. I wish you'd have pulled the emergency brake before dumping them into so many issues queues... :-)

Gábor Hojtsy’s picture

Title: Drupal 9 Deprecated Code Report » [META] Deprecation issues in devel module
Category: Task » Plan

Retitling as per #5 and #7. Plenty of issue to resolve to make this a meta instead of resolving all at once.

mikelutz’s picture

Issue summary: View changes

Cleaning up the issue a bit, removing the autoloader errors, and trimming the separators.

jonathan1055’s picture

Seeing that some of the child issues are fixed it looks like work has been done on this, so here is a patch which will show the remaining uses of deprecated code which have @trigger_error. I know there are deprecations which don't trigger an error yet, but at least this patch will show the ones that do.

jonathan1055’s picture

Issue summary: View changes
FileSize
26.51 KB

Re-wrote the issue summary to show the deprecations reported by suppress-deprecations: false and list the remaining ones from the original report by message, not list each one by file & occurrence. Some of these will have been fixed already.

jonathan1055’s picture

Issue summary: View changes

Removed from issue summary:
Call to deprecated function entity_create().
Call to deprecated function entity_load_multiple_by_properties().
Call to deprecated function entity_get_display().
Call to deprecated function entity_get_form_display().

These four have already been fixed in #3044234: Replace deprecated entity_* calls with proper calls to the entity api

jonathan1055’s picture

Issue summary: View changes

Updated issue summary afer running on core 8.8 and also using combined results from my Travis buid.

jonathan1055’s picture

Issue summary: View changes

Removed details of db_ deprecations and moved them into #2872725: Replace deprecated db_* functions

martin107’s picture

I added a new issue, I already have the 4 line patch...

#3094851: Replace calls to $this->l() with Link::fromTextandUrl()

martin107’s picture

A couple of issues

A) Upstream in phpstan they are discussing adding a directive of the form

// phpstan-ignore-next-line

As seen in every other lint/static analyser tools I have used.

IF that ever gets in we could remove a couple of warning from the output of drupal-check

While working that story out I opened and closed

#3094863: convert calls to _csv_to_array() into StringUtils::csvToArray()

If anyone here has a different opinion I would be glad to hear it

B) There is now a ultra trivial conversion of a call to $this->url()

#3094932: Replace call to $this->url() with call to Url::fromRoute()

jonathan1055’s picture

Issue summary: View changes

Updated the deprecation report in issue summary

jonathan1055’s picture

Issue summary: View changes

Removed

8x: _db_get_target() is deprecated in drupal:8.8.0. Will be removed before drupal:9.0.0. See https://www.drupal.org/node/2993033

as this is an internal function and is no longer reported (exists in core/includes/database.inc)

Removed

 11x: Drupal\Core\Routing\UrlGeneratorTrait::url() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Url::fromUri() instead. See https://www.drupal.org/node/2614344

  11x: Drupal\Core\Routing\UrlGeneratorTrait::getUrlGenerator() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use the url_generator service instead. See https://www.drupal.org/node/2614344

as these are now fixed.

Added three new issues for the top three deprecations
#3095311: Replace deprecated EntityManagerInterface::getStorage() with EntityTypeManager::getStorage()
#3095314: Add $defaultTheme to tests extending BrowserTestBase and JavascriptTestBase
#3095363: Replace deprecated \Drupal\Core\Path\AliasStorage

jonathan1055’s picture

Issue summary: View changes

#3095311: Replace deprecated EntityManagerInterface::getStorage() with EntityTypeManager::getStorage() is fixed, which removed 111 deprecation messages (the previous top spot).

The total is now down to 147 deprecation messages, although the numbers fluctuate a little due to the randomness in the DevelGenerate tests.

martin107’s picture

Added

#3096066: Replace deprecated version of getBaseThemes() with getBaseThemeExtensions()

This will remove 2 entries of the type

  Line   webprofiler/src/Views/TraceableViewExecutable.php                                  
 ------ ----------------------------------------------------------------------------------- 
  71     Call to deprecated method getBaseThemes() of class Drupal\Core\Theme\ActiveTheme:  
         in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use                       
         \Drupal\Core\Theme\ActiveTheme::getBaseThemeExtensions() instead.                  
 ------ ----------------------------------------------------------------------------------- 
martin107’s picture

Added

#3096263: Replace calls to file_directory_temp()

which replaces 2 calls in our code base.

jonathan1055’s picture

Issue summary: View changes

#3095314: Add $defaultTheme to tests extending BrowserTestBase and JavascriptTestBase is fixed, dropping the deprecation count by 45 (which had been the largest count).

jonathan1055’s picture

Issue summary: View changes

#2872725: Replace deprecated db_* functions is fixed and the deprecation messages are down to 87

jonathan1055’s picture

jonathan1055’s picture

jonathan1055’s picture

Issue summary: View changes

The 3 warnings for file_directory_temp() is deprecated are reduced to 1 after #3095474: Add settings for debug filename and <pre> formatting
Deprecation count is down to 67.

jonathan1055’s picture

Attached are the latest outputs from drupal-check. Using -d for deprecations we get 38 messages, and -a for analysis shows 214 messages. Better to attach the files rather than paste the output here.

jonathan1055’s picture

Issue summary: View changes

#3096263: Replace calls to file_directory_temp() removed 1x
#3098816: Replace deprecated drupal_get_message with Messenger service removed 10x

Reduced by 11 but also increased by 8, hence only 3 down overall. The higher counts for other existing messages due to increased webprofiler test coverage added in #3106747: BlocksDataCollector is calling getStorage on non existing property. The new webprofiler test also highlighted one new message "drupal_get_profile() is deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use the install_profile container parameter or \Drupal::installProfile() instead" although this was already being shown in the drupal-check static analysis.

jonathan1055’s picture

#3112914: Deprecation: Remove calls to the deprecated function drupal_get_profile() has fixed 4x: drupal_get_profile() is deprecated in drupal:8.3.0

#3100274: Replace deprecated file_prepare_directory() with ->prepareDirectory() has fixed 3x: file_prepare_directory() is deprecated in Drupal 8.7.0

Deprecation count down 7 to 57

jonathan1055’s picture

Issue summary: View changes

Landed #3100281: Deprecations: Replace non-boolean use of assertTrue()

Down to 7 distinct deprecation message types. Total count has increased due to more tests in #1277654: Generate translated content.

jonathan1055’s picture

jonathan1055’s picture

Issue summary: View changes
Related issues: +#3127486: Devel deprecations from D9 drupal-check report

I have created #3127486: Devel deprecations from D9 drupal-check report to deal with the drupal-check deprecations as those are not reported by @trigger_error and will therefore not be shown in tests. It will be easier to follow if we split them off into a separate parent issue.