[wp-trac] [WordPress Trac] #45593: Type compatibility: Parameter '$plugin_editable_files' type is not compatible with declaration

WordPress Trac noreply at wordpress.org
Wed Dec 12 11:47:51 UTC 2018


#45593: Type compatibility: Parameter '$plugin_editable_files' type is not
compatible with declaration
------------------------------+-----------------------------
 Reporter:  subrataemfluence  |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Plugins           |    Version:  5.0
 Severity:  normal            |   Keywords:  has-patch
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 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
 <?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
 <?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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45593>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list