WordPress.org

Make WordPress Core

Opened 5 weeks ago

#44411 new enhancement

Add property doc in child class

Reported by: subrataemfluence Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
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 5 weeks ago.
Proposed patch for class-wp-customize-image-control.php
44411.class-wp-customize-upload-control.diff (921 bytes) - added by subrataemfluence 5 weeks ago.
Proposed patch for class-wp-customize-upload-control.php

Download all attachments as: .zip

Change History (2)

@subrataemfluence
5 weeks ago

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

@subrataemfluence
5 weeks ago

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

Note: See TracTickets for help on using tickets.