Comments

joachim created an issue. See original summary.

robindh’s picture

StatusFileSize
new10.73 KB

Patch for version 8.9.x

robindh’s picture

Status: Active » Needs review
joachim’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the patch! Looks good.

vodde83’s picture

Agreed, looks good

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Thank you for your work on cleaning up Drupal core's code style!

In order to fix core coding standards in a maintainable way, all our coding standards issues should be done on a per-rule basis across all of core, rather than fixing standards in individual modules or files. We should also separate fixes where we need to write new documentation from fixes where we need to correct existing standards. This all should be done as part of #2571965: [meta] Fix PHP coding standards in core, stage 1. A good place to start is the child issues of #2572645: [Meta] Fix 'Drupal.Commenting.FunctionComment' coding standard.

For background information on why we usually will not commit coding standards fixes that aren't scoped in that way, see the core issue scope guidelines, especially the note about coding standards cleanups. That document also includes numerous suggestions for scoping issues including documentation coding standards cleanups.

Contributing to the overall plan above will help ensure that your fixes for core's coding standards remain in core the long term.

In this instance we need to add a new sniff to discover classes without a leading slash to the coder project.

joachim’s picture

This is affecting Drupal Code Builder, which outputs broken code because of this.

I'll look into creating a sniff, but please could we fix this in the meantime? It's not just a coding standards issue.

jungle’s picture

Version: 8.8.x-dev » 8.9.x-dev

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

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

narendra.rajwar27’s picture

Status: Needs work » Needs review
siddhant.bhosale’s picture

Assigned: Unassigned » siddhant.bhosale
siddhant.bhosale’s picture

Assigned: siddhant.bhosale » Unassigned
Status: Needs review » Reviewed & tested by the community

The patch works against the branch 9.1.x. Looks good to be merged. Thank you.

jungle’s picture

Issue tags: +Needs followup
  1. If this is counted as a non-coding standard issue, we need a follow-up to fix the occurrences across the codebase.
  2. Otherwise, we have to wait for a sniff for this.
jungle’s picture

Adding a related issue. A follow-up seems unnecessary

xjm’s picture

Status: Reviewed & tested by the community » Needs review
Related issues: +#3054969: Add sniff for \Drupal vs Drupal

*.api.php are just documentation; does Drupal Code Builder somehow parse them to do the code generation?

I personally would want to ensure this was fixed at least in all *.api.php either way. A sniff has still not been created yet and other *.api.php are also wrong, including in hook signatures and the like.

If we could get clarity on what exactly the bug that's being caused is, that'd make it easier to make sure we're fixing that bug completely (here and/or elsewhere).

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.

quietone’s picture

Status: Needs review » Closed (duplicate)
Issue tags: -Novice
Parent issue: » #3188974: [Meta] Consistent use of leading \ for class names

I happened across an issue that precedes this and does the same work, thus making this a duplicate.

Closing this as a duplicate of #2859992: [PP-1] Consistent use of leading \ for class names in *.api.php files, added the patch here to the patch there and added credit. I hope I did the credit correctly.

Adding this as child to the meta about the leading \ in class names.

quietone’s picture