WP-API / docs

The content for developer.wordpress.org/rest-api
https://developer.wordpress.org/rest-api
110 stars 615 forks source link

Update outdated PHP 5.2 discussion on controller class page #83

Closed kadamwhite closed 4 years ago

kadamwhite commented 4 years ago

Because WordPress now supports 5.6, the note about namespaces on this page is no longer accurate. I've provisionally replaced it with a brief introduction to the code structure problem which classes solve, and a note that namespaces may be used in a similar fashion.

Fixes #79

TimothyBJacobs commented 4 years ago

The new overview language looks great to me.

The "namespaces vs classes" section feels weird to me. I think typically the distinction is using namespaces vs prefixes. So to me that section feels kinda apples and oranges. It is a coding style type of thing, though. For instance, I almost never follow the namespaced function pattern, instead opting to consolidate in a class.

Extending the base class provides so much functionality, that I’m kinda hesitant to recommend writing it as separate functions. To me, the separate functions approach (or writing your own class that does not extend WP_REST_Controller) feels like the advanced option, and extending the base class is the most straightforward usage.

TimothyBJacobs commented 4 years ago

Looks good to me!