[wp-trac] [WordPress Trac] #54670: Gutenberg / newly introduced functions referring to non-existent class properties

WordPress Trac noreply at wordpress.org
Tue Dec 21 00:26:58 UTC 2021


#54670: Gutenberg / newly introduced functions referring to non-existent class
properties
------------------------------+-----------------------------
 Reporter:  jrf               |       Owner:  hellofromTonya
     Type:  defect (bug)      |      Status:  closed
 Priority:  normal            |   Milestone:  5.9
Component:  Editor            |     Version:  trunk
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:
------------------------------+-----------------------------
Changes (by hellofromTonya):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"52397" 52397]:
 {{{
 #!CommitTicketReference repository="" revision="52397"
 Editor: Explicitly declare `$post_types` and `$area` properties in
 `WP_Block_Template` class.

 The `$post_types` and `$area` properties are assigned in the
 `_build_block_template_result_from_file()` and
 `_build_block_template_result_from_post()` functions. However, neither
 property was explicitly declared in the `WP_Block_Template` class.

 This commit explicitly declares both properties in the class. Why? (1) To
 make the code more readable and maintainable; (2) to avoid a `Deprecated:
 Creation of dynamic property WP_Block_Template::$post_types is deprecated`
 deprecation when PHP 8.2 is released.

 Ref:
 * PHP 8.2 Deprecate dynamic properties
 https://wiki.php.net/rfc/deprecate_dynamic_properties

 Follow-up to [52062].

 Props jrf.
 Fixes #54670.
 }}}

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


More information about the wp-trac mailing list