[wp-trac] [WordPress Trac] #36492: Add `WP_Post_Status` class

WordPress Trac noreply at wordpress.org
Mon May 23 04:48:41 UTC 2016


#36492: Add `WP_Post_Status` class
------------------------------------+------------------------------
 Reporter:  flixos90                |       Owner:  DrewAPicture
     Type:  enhancement             |      Status:  reviewing
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Posts, Post Types       |     Version:  3.0
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+------------------------------

Comment (by schlessera):

 Was there any consideration for implementing post statuses as an actual
 "enumerated" (or "enum") data type (or at least a PHP simulation thereof)?

 Benefits would be:

 * Correct data type, as it is the correct representation of a finite set
 of values.
 * Proper, semantic equality checking.
 * Proper, semantic way of getting all accepted values.
 * Type-hinting on the actual status value if wanted.

 A useful implementation example would be https://github.com/marc-mabe/php-
 enum, which could probably be rewritten to work without namespaces.

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


More information about the wp-trac mailing list