[wp-trac] [WordPress Trac] #62561: Inaccurate PHPDoc Type for WP_Block_Parser_Frame::leading_html_start

WordPress Trac noreply at wordpress.org
Mon Nov 25 08:52:54 UTC 2024


#62561: Inaccurate PHPDoc Type for WP_Block_Parser_Frame::leading_html_start
-------------------------+------------------------------
 Reporter:  marian1      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  trivial      |  Resolution:
 Keywords:  has-patch    |     Focuses:  docs
-------------------------+------------------------------

Comment (by hamzadev0000):

 To address this discrepancy, you can update the property type hint or its
 PHPDoc to reflect that WP_Block_Parser_Frame::leading_html_start can
 accept both int and null. Here's how you can do it:

 == Update the PHPDoc for Clarity

 {{{#!php
 <?php
 class WP_Block_Parser_Frame {
     /**
      * The starting position of the leading HTML.
      *
      * @var int|null
      */
     public $leading_html_start;

     /**
      * Constructor to initialize the property.
      *
      * @param int|null $leading_html_start Starting position of the
 leading HTML.
      */
     public function __construct($leading_html_start = null) {
         $this->leading_html_start = $leading_html_start;
     }
 }
 }}}

 Ensure the property is documented as int|null:

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


More information about the wp-trac mailing list