[wp-trac] [WordPress Trac] #62018: HTML API: Satisfy return types in new methods

WordPress Trac noreply at wordpress.org
Mon Sep 9 22:10:25 UTC 2024


#62018: HTML API: Satisfy return types in new methods
--------------------------+------------------------------
 Reporter:  dlh           |       Owner:  dmsnell
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  HTML API      |     Version:  trunk
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------
Changes (by dmsnell):

 * owner:  (none) => dmsnell
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"59001" 59001]:
 {{{
 #!CommitTicketReference repository="" revision="59001"
 HTML API: Add sentinels for unreachable code.

 There are places in the HTML API code where some tools get confused and
 flag invalid types for the return of a function because they are unable to
 detect that the end of the function is unreachable.

 Since PHP doesn't provide a way to encode total matching in the source
 code, this patch adds a few extra lines in those unreachable locations to
 satisfy any tooling which isn't able to fully analyze the code.

 Additionally this serves as extra guarding in case someone changes these
 functions in a way which would break them and the existing test suite
 doesn't catch those breakages.

 Developed in https://github.com/WordPress/wordpress-develop/pull/7315
 Discussed in https://core.trac.wordpress.org/ticket/62018

 Props dlh, dmsnell.
 Fixes #62018.
 }}}

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


More information about the wp-trac mailing list