[wp-trac] [WordPress Trac] #43304: Data type of deprecated parameter of load_plugin_textdomain function should be bool and not string

WordPress Trac noreply at wordpress.org
Tue Feb 13 05:10:27 UTC 2018


#43304: Data type of deprecated parameter of load_plugin_textdomain function should
be bool and not string
------------------------------------+-----------------------------
 Reporter:  sudar                   |      Owner:
     Type:  defect (bug)            |     Status:  new
 Priority:  normal                  |  Milestone:  Awaiting Review
Component:  I18N                    |    Version:  trunk
 Severity:  normal                  |   Keywords:
  Focuses:  docs, coding-standards  |
------------------------------------+-----------------------------
 The second parameter of the `load_plugin_textdomain` function has been
 deprecated. The default value of this parameter is set to false and if we
 pass anything other than false, then a deprecated notice is triggered.

 {{{#!php
 <?php
         if ( false !== $plugin_rel_path ) {
                 $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/'
 );
         } elseif ( false !== $deprecated ) {
                 _deprecated_argument( __FUNCTION__, '2.7.0' );
                 $path = ABSPATH . trim( $deprecated, '/' );
         } else {
                 $path = WP_PLUGIN_DIR;
         }
 }}}

 But in the phpdoc block of this function the second parameter is still
 specified as string. But in practise the only value that can be passed to
 this function that does not trigger a deprecated warning is `false`.

 This generates a error in lot of static code analysers/services like
 scrutinizer that deduces the data type of the parameter from phpdoc block.

 The data type of the parameter should be changed to either bool or should
 be explicitly stated as `false` (even better)

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


More information about the wp-trac mailing list