WebDevStudios / oops-wp

A collection of abstract classes, interfaces, and traits to promote object-oriented programming practices in WordPress.
57 stars 9 forks source link

Update PostType class to extend abstract ContentType #7

Closed jmichaelward closed 5 years ago

jmichaelward commented 5 years ago

See #6. Once the ContentType class has been developed, PostType should be updated to extend from it and abide by its contract. If this can be done without breaking compatibility, it will go in the next minor release, otherwise, it would be a part of 1.0.0.

jmichaelward commented 5 years ago

There's a branch for this task here: https://github.com/WebDevStudios/oops-wp/tree/issue/%237-update-posttype-class-to-extend-contenttype

It includes the work in #8, so any work that gets updated in that feature branch will need to be rolled into the issue branch for compatibility.

We'll need to test this update to confirm whether this work can be included in the next release (0.2.0), or if the changes herein are in fact BC-breaking, in which case it will have to wait until a 1.0.0 release so that developers can opt in to the upgrade knowing that they'll have to make some changes to their post type registration classes.

jmichaelward commented 5 years ago

@phatsk FYI, I took another look at array_merge, and in particular, how wp_parse_args calls it. The default arguments in fact come first, so I reversed them in the register method here. I also set get_args to call the deprecated get_registration_arguments method. That way, if developers use the new version of 0.2.0 and correctly call get_args in their PostType, it'll override; otherwise, it'll call get_registration_arguments, which returns the empty array we would expect.

Given these changes, I think this is now backward compatible and that we'll be able to include it in the 0.2.0 release.

jmichaelward commented 5 years ago

Closing as #8 had been merged into the develop branch.