Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

Move the work here to #2981326: Replace non-test usages of \Drupal::logger() with IoC injection and #3123228: Replace non-test usages of \Drupal::state() with IoC injection
Then, close this as a duplicate.

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3106275

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Hardik_Patel_12 created an issue. See original summary.

hardik_patel_12’s picture

StatusFileSize
new2.54 KB

Kindly review a patch.

hardik_patel_12’s picture

Assigned: hardik_patel_12 » Unassigned
Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: use_DI-3106275-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

hardik_patel_12’s picture

StatusFileSize
new472 bytes
new2.53 KB

Kindly review a new patch.

hardik_patel_12’s picture

Status: Needs work » Needs review
longwave’s picture

Status: Needs review » Needs work
+++ b/core/modules/system/system.services.yml
@@ -1,6 +1,7 @@
+    arguments: ['@logger.channel.default', '@state']

This should be @logger.channel.cron.

hardik_patel_12’s picture

StatusFileSize
new193 bytes
new2.53 KB

Kindly review a new patch.

hardik_patel_12’s picture

Status: Needs work » Needs review
hardik_patel_12’s picture

hardik_patel_12’s picture

Sorry bymistakly done above comment

kishor_kolekar’s picture

StatusFileSize
new2.53 KB

I've re-rolled patch for 9.1

kishor_kolekar’s picture

Status: Needs review » Needs work

sorry please avoid the above patch.

kishor_kolekar’s picture

Version: 9.0.x-dev » 9.1.x-dev
kishor_kolekar’s picture

Status: Needs work » Needs review
StatusFileSize
new2.53 KB

re-rolled patch for 9.1

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record, +Needs Review Queue Initiative, +Needs tests

This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

Seems now that the service requires arguments it will need a BC layer.
In the constructor they should default to NULL with a trigger_error that it will be required in D11
Which then requires tests for the message.

Change record will also have to be added announcing this service arguments are required.

prem suthar’s picture

StatusFileSize
new2.52 KB

Re-roll the Patch For 10.1x Branch.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

angrytoast made their first commit to this issue’s fork.

angrytoast’s picture

Status: Needs work » Needs review

Updating to a MR against 11.x and incorporating the BC trigger_error warnings per #21 and https://www.drupal.org/about/core/policies/core-change-policies/drupal-d....

Clarification on tests; as of 2023-12-15, https://www.drupal.org/about/core/policies/core-change-policies/drupal-d... states

Tests are not required where the test would only be asserting that a deprecation message is triggered

The suggested tests would fall under only asserting a deprecation message? Is it required?

As I understand it, the change record is still necessary. Just wanted to confirm the test requirement because it seems contradictory.

smustgrave’s picture

Status: Needs review » Needs work

So kinda,

Relooking at this I'm wondering if we have to do the backwards compatibility dance. If a contrib module could extend this class they won't have the new services we are passing into it so would need some trigger_errors

And those would need simple test cases for the exception message.

angrytoast’s picture

Status: Needs work » Needs review
Issue tags: -Needs change record, -Needs tests

Gotcha, updated the MR with a basic kernel test to assert the deprecation messaging and drafted up a change record.

That looks like it should be enough? Putting back in needs review.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Deprecation additions look good to me.

quietone’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

I'm triaging RTBC issues. There is no issue summary here! The only information is the title.

An issue summary really is needed no matter how simple one may think the issue is. It is what helps us at every stage of an issue to complete it and keep track of details.
--

This looks like it should be part of a meta. I say that because we normally do not make such changes by file, they are scoped by the type of change. In this case there would be an issue for changing all instances of logger and all instances of state.

After a very brief search I found #2729597: [meta] Replace \Drupal with injected services where appropriate in core where there are existing issues for logger and state. The work here needs to move to #2981326: Replace non-test usages of \Drupal::logger() with IoC injection and #3123228: Replace non-test usages of \Drupal::state() with IoC injection.

If you are unsure about scope, you can read about Drupal standard practice for how to scope issue. And there is always the option to ask in Drupal slack.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.