PostType objects do not currently throw an exception if a $slug property is not defined, which can be confusing to developers when trying to extend the PostType class.
The Taxonomy class runs a requirements check before attempting to register a taxonomy, which alerts developers if the $slug or $object_types properties are missing. That implementation probably needs a little work (clearly the conditional in the register method there never actually passes if an exception is thrown), but it could serve as a model for how to address this missing exceptions in the PostType class. See: https://github.com/WebDevStudios/oops-wp/blob/master/src/Structure/Content/Taxonomy.php#L53
PostType
objects do not currently throw an exception if a$slug
property is not defined, which can be confusing to developers when trying to extend thePostType
class.The
Taxonomy
class runs a requirements check before attempting to register a taxonomy, which alerts developers if the$slug
or$object_types
properties are missing. That implementation probably needs a little work (clearly the conditional in theregister
method there never actually passes if an exception is thrown), but it could serve as a model for how to address this missing exceptions in thePostType
class. See: https://github.com/WebDevStudios/oops-wp/blob/master/src/Structure/Content/Taxonomy.php#L53