WordPress.org

Make WordPress Core

#45593 closed enhancement (fixed)

Docs: Parameter '$plugin_editable_files' type is not compatible with declaration

Reported by: subrataemfluence Owned by: pento
Milestone: 5.1 Priority: normal
Severity: normal Version: 5.0
Component: Plugins Keywords: has-patch good-first-bug
Focuses: docs Cc:

Description

The parameter $plugin_editable_files accepts an array in the following function but the in Doc block, it has been defined as string, which is incorrect. It has to be declared as an array.

<?php
/**
 * Makes a tree structure for the Plugin Editor's file list.
 *
 * @since 4.9.0
 * @access private
 *
 * @param string $plugin_editable_files List of plugin file paths.
 * ...
 */
function wp_make_plugin_file_tree( $plugin_editable_files ) {
  $tree_list = array();
  foreach ( $plugin_editable_files as $plugin_file ) {
     ...
  }
  return $tree_list;
}

Here is a call made in plugin-editor.php

<?php
$plugin_editable_files = array();
foreach ( $plugin_files as $plugin_file ) {
  ...
  $plugin_editable_files[] = $plugin_file;
}

...
wp_print_plugin_file_tree( wp_make_plugin_file_tree( $plugin_editable_files ) );
...

where $plugin_editable_files is passed as an array.

Attachments (1)

45593.patch (569 bytes) - added by subrataemfluence 22 months ago.

Download all attachments as: .zip

Change History (5)

#1 @mukesh27
22 months ago

  • Focuses docs added; coding-standards removed
  • Keywords good-first-bug added
  • Summary changed from Type compatibility: Parameter '$plugin_editable_files' type is not compatible with declaration to Docs: Parameter '$plugin_editable_files' type is not compatible with declaration
  • Type changed from defect (bug) to enhancement

#2 @SergeyBiryukov
22 months ago

  • Milestone changed from Awaiting Review to 5.1
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#3 @pento
21 months ago

  • Owner changed from SergeyBiryukov to pento
  • Status changed from reviewing to accepted

#4 @pento
21 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 44464:

Docs: Fix the @param type for wp_make_plugin_file_tree().

$plugin_editable_files is an array, not a string.

Props subrataemfluence.
Fixes #45593.

Note: See TracTickets for help on using tickets.