WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 15 months ago

#44411 new enhancement

Add property doc in child class

Reported by: subrataemfluence Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: 2nd-opinion
Focuses: coding-standards Cc:

Description

There are few classes where doc comments are missing for public property declaration.

Examples:

<?php
class WP_Customize_Image_Control extends WP_Customize_Upload_Control {
  public $type      = 'image';
  public $mime_type = 'image';
  ...
}

The above class extends WP_Customize_Upload_Control:

<?php
class WP_Customize_Upload_Control extends WP_Customize_Media_Control {
  public $type          = 'upload';
  public $mime_type     = '';
  public $button_labels = array();
  public $removed       = ''; // unused
  public $context; // unused
  public $extensions = array(); // unused
  ...
}

Although the properties are documented in WP_Customize_Media_Control, it would be good to have them documented inside the scope of each class also. Otherwise one has to navigate to the class which it extends to read the actual documentation. Some cases like the one above could have a multi-level navigation.

Is this worth doing for the sake of better code readability?

Related #44410

Attachments (2)

44411.class-wp-customize-image-control.diff (637 bytes) - added by subrataemfluence 22 months ago.
Proposed patch for class-wp-customize-image-control.php
44411.class-wp-customize-upload-control.diff (921 bytes) - added by subrataemfluence 22 months ago.
Proposed patch for class-wp-customize-upload-control.php

Download all attachments as: .zip

Change History (3)

@subrataemfluence
22 months ago

Proposed patch for class-wp-customize-image-control.php

@subrataemfluence
22 months ago

Proposed patch for class-wp-customize-upload-control.php

#1 @pento
15 months ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.