Make WordPress Core


Ignore:
Timestamp:
07/19/2024 11:42:14 PM (8 months ago)
Author:
dmsnell
Message:

HTML API: Add PHP type annotations.

This patch adds type annotations to internal and private methods of the HTML
API and the supporting WP_Token_Map. Annotations have not been added to the
public interfaces where it would likely crash a site if called wrong.

These annotations should help avoid unnecessary type-related bugs (as have
been uncovered in earlier work adding such annotations) and provide additional
guidance to developers when interacting with these classes in an IDE.

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

Props dmsnell, jonsurrell.
See #61399.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/html-api/class-wp-html-processor-state.php

    r58680 r58769  
    334334     * @var WP_HTML_Open_Elements
    335335     */
    336     public $stack_of_open_elements = null;
     336    public $stack_of_open_elements;
    337337
    338338    /**
     
    347347     * @var WP_HTML_Active_Formatting_Elements
    348348     */
    349     public $active_formatting_elements = null;
     349    public $active_formatting_elements;
    350350
    351351    /**
Note: See TracChangeset for help on using the changeset viewer.