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:
- 15x: \Drupal\Core\Path\AliasStorage is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use the "path_alias.repository" service instead, or the entity storage handler for the "path_alias" entity type for CRUD methods. See https://www.drupal.org/node/3013865.
(note - the number here will vary due to the random element in devel generate content tests)
#3095363: Replace deprecated \Drupal\Core\Path\AliasStorage - 15x: The Drupal\Core\Entity\Query\QueryFactory class is deprecated in Drupal 8.3.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\Entity\EntityStorageInterface::getQuery() or \Drupal\Core\Entity\EntityStorageInterface::getAggregateQuery() instead. See https://www.drupal.org/node/2849874
#3098811: Replace deprecated QueryFactory class with EntityStorageInterface - 4x: The Drupal\FunctionalJavascriptTests\JavascriptTestBase is deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.0. Instead, use Drupal\FunctionalJavascriptTests\WebDriverTestBase. See https://www.drupal.org/node/2945059
#3097125: Replace deprecated JavascriptTestBase with WebDriverTestBase - 4x: \Drupal\user\PrivateTempStoreFactory is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStoreFactory instead. See https://www.drupal.org/node/2935639
#3100276: Replace deprecated user.private_tempstore and user.shared_tempstore with services now in Core - 4x: \Drupal\user\SharedTempStoreFactory is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStoreFactory instead. See https://www.drupal.org/node/2935639
#3100276: Replace deprecated user.private_tempstore and user.shared_tempstore with services now in Core
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
- Determine which of the above notices are not yet covered by child issues
- Create the child issue required
- When a few child issues have beeen fixed update this issue summary with the reduced numbers
Comment | File | Size | Author |
---|---|---|---|
#33 | 3042575-33.show_deprecations.patch | 452 bytes | jonathan1055 |
Comments
Comment #2
salvisDoes this (and similar postings) make you feel good?
Comment #3
mikelutzRespectfully, 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.
Comment #4
moshe weitzman CreditAttribution: moshe weitzman commentedPlease open a new issue with patches to fix the highlighted deprecations.
Comment #5
mikelutzThe 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.
Comment #6
mikelutzWhoops, I'm sorry. I didn't mean to reopen.
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedI'd welcome such patches, so please keep us on the list. Thanks for your work, mikelutz.
Comment #8
salvisOk, 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... :-)
Comment #9
Gábor HojtsyRetitling as per #5 and #7. Plenty of issue to resolve to make this a meta instead of resolving all at once.
Comment #10
mikelutzCleaning up the issue a bit, removing the autoloader errors, and trimming the separators.
Comment #11
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedSeeing 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.
Comment #12
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedRe-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.Comment #13
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedRemoved 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
Comment #14
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedUpdated issue summary afer running on core 8.8 and also using combined results from my Travis buid.
Comment #15
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedRemoved details of db_ deprecations and moved them into #2872725: Replace deprecated db_* functions
Comment #16
martin107 CreditAttribution: martin107 as a volunteer commentedI added a new issue, I already have the 4 line patch...
#3094851: Replace calls to $this->l() with Link::fromTextandUrl()
Comment #17
martin107 CreditAttribution: martin107 as a volunteer commentedA 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()
Comment #18
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedUpdated the deprecation report in issue summary
Comment #19
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedRemoved
as this is an internal function and is no longer reported (exists in core/includes/database.inc)
Removed
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
Comment #20
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commented#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.
Comment #21
martin107 CreditAttribution: martin107 as a volunteer commentedAdded
#3096066: Replace deprecated version of getBaseThemes() with getBaseThemeExtensions()
This will remove 2 entries of the type
Comment #22
martin107 CreditAttribution: martin107 as a volunteer commentedAdded
#3096263: Replace calls to file_directory_temp()
which replaces 2 calls in our code base.
Comment #23
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commented#3095314: Add $defaultTheme to tests extending BrowserTestBase and JavascriptTestBase is fixed, dropping the deprecation count by 45 (which had been the largest count).
Comment #24
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commented#2872725: Replace deprecated db_* functions is fixed and the deprecation messages are down to 87
Comment #25
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedFixed
9x in #3099029: Replace deprecated getMock() with createMock()
4x in #3100262: Deprecation: Remove calls to KernelTestBase::installSchema which have invalid schema names
Deprecation count at Core 8.9 is now down from 87 to 74.
Comment #26
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commented#3100242: Replace deprecated system_rebuild_module_data() with \Drupal::service('extension.list.module') is fixed.
Deprecation count down to 69.
Comment #27
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThe 3 warnings for
file_directory_temp() is deprecated
are reduced to 1 after #3095474: Add settings for debug filename and <pre> formattingDeprecation count is down to 67.
Comment #28
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedAttached 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.Comment #29
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commented#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.
Comment #30
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commented#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
Comment #31
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedLanded #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.
Comment #32
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedFixed:
#3097233: Render #lazy_builder callback must be in class TrustedCallbackInterface or anonymous function
#3100292: Replace deprecated file_save_htaccess() with \FileSecurity::writeHtaccess()
#3118260: Remove the deprecated Drupal\Core\Routing\LinkGeneratorTrait
Part-fixed:
#3095363: Replace deprecated \Drupal\Core\Path\AliasStorage
Deprecations messages dropped from 80 to 42. Thanks to all who are helping with this this.
Comment #33
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedPatch #11 needed a re-roll due to #3122541: Remove unrequired Twig update in drupalci.yml
Comment #34
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedI 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.