OO: Documentation standards: documenting every constant "overkill" when context is clear.

Created on 20 July 2014, over 10 years ago
Updated 11 February 2025, about 2 months ago

The Drupal API documentation and comment standards currently state:

Every function, constant, class, interface, class member (function, property, constant), and file must be documented, even private class members.

Why should I invest time documenting these, are they otherwise too mysterious ?

class XHTML {
  const TABLE = 'table';
  const TR = 'tr';
  const TD = 'td';
  const TH = 'th';
  const A = 'a';
  const P = 'p';
  const B = 'b';
  const STRONG = 'strong';
  const I = 'i';
  const EM = 'em';
  const DIV = 'div';
  const IMG = 'img';
  const SPAN = 'span';
  const HR = 'hr';
  const BR = 'br';
  const BLOCKQUOTE = 'blockquote';
  const OL = 'ol';
  const UL = 'ul';
  const DL = 'dl';
}

Where is the "value add" in doing this over and over:

  /**
   * The XHTML DL tag name constant.
   * @var
   */
  const DL = 'dl';

[EDIT: thankfully Coder does not currently report on these.]

Feature request
Status

Postponed: needs info

Component

Coding Standards

Created by

🇦🇺Australia webel

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

  • Documentation

    Primarily changes documentation, not code. For Drupal core issues, select the Documentation component instead of using this tag. In general, component selection is preferred over tag selection.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand quietone

    Is there interest in changing the standard?

  • 🇧🇪Belgium borisson_ Mechelen, 🇧🇪

    I think the standard should still exist, and the usecase in the IS should nowadays be an enum, which already doesn't require comments on each property.

    I think we can close this as won't fix, given the lack of interest on this issue in the past 11 years.

  • 🇳🇿New Zealand quietone

    @borisson_, thanks. I agree.

    I am going to close this. If anyone disagrees, reopen the issue and add a comment. Thanks.

Production build 0.71.5 2024