Problem/Motivation

There are several issues in core about making the use of the \ in namespaces consistent in core. Some of the work in those issues overlaps each other.

#3144809: PHPCS rule for consistent usage of '\Drupal'

#2859992: [PP-1] Consistent use of leading \ for class names in *.api.php files
#2912687: [PP-1] Consistent use of leading \ for class names in comments
#3082854: [PP-1] Consistently use \Drupal::foo() instead of Drupal::foo()
#3089634: missing initial backslash on parameter interface typehints in entity.api.php
#3123593: [PP-1] Class names in *.services.yml inconsistently use leading \

Steps to reproduce

Proposed resolution

Create a meta to separate the work into clearly defined manageable pieces. Mark all as postponed on #3054969: Add sniff for \Drupal vs Drupal.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

quietone created an issue. See original summary.

quietone’s picture

Title: Consistent use of leading \ in class names » Consistent use of leading \ for class names
quietone’s picture

Title: Consistent use of leading \ for class names » [Meta] Consistent use of leading \ for class names

Haven't found any more issue about the lead back slash.

quietone’s picture

atul4drupal’s picture

@quietone Nice work in putting the pieces together :) this should help address the issue.

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.

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.

quietone’s picture

Status: Active » Postponed
quietone’s picture

Issue tags: +Coding standards

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.