KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What's the recommended way to document function or method parameters whose value is expected to be a predefined constant? So far, I use the data type of the constant and I add a little explanation later. E.g.: <?php class Foo{ const METHOD_GET = 'get'; const METHOD_POST = 'post'; /** * Load a new foo * * @param string $method HTTP method to use (either Foo::METHOD_GET or Foo::METHOD_POST) */ public function load($method=Foo::METHOD_POST){ // ... } /** * Sort current foo * * @param int $sort_order Sort order (either SORT_ASC or SORT_DESC) */ public function sort($sort_order=SORT_ASC){ // ... } }
Tags (comma-separated)
Save Edits
Cancel