[wp-trac] [WordPress Trac] #52539: callable typehint thows static analysis errors

WordPress Trac noreply at wordpress.org
Tue Feb 16 16:49:35 UTC 2021


#52539: callable typehint thows static analysis errors
--------------------------+------------------------------
 Reporter:  dingo_d       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  docs
--------------------------+------------------------------
Changes (by johnbillion):

 * keywords:  dev-feedback 2nd-opinion has-patch => has-patch
 * version:  trunk =>


Comment:

 A string is a callable. The problem here is not the string, it's that the
 default value is an ''empty'' string, which is not a callable.

 IMO rather than changing the docblock to `callable|string` the default
 value should be changed to `null` so it's nullable. Otherwise passing an
 arbitrary non-callable string becomes possible which is not useful.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52539#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list