Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use @package & @subpackage in phpdoc?

Tags:

php

phpdoc

I'm wondering how I should use @package & @subpackage for class doc.

let say I've the following class

class My_Controller_Action_Helper_MyHelperAction extends Foo_Bar {}

Should it be:

@category    My
@package     Controller
@subpackage  Action_Helper

or

@category    My
@package     Controller
@subpackage  Action_Helper_MyHelperAction

or

@category    My
@package     Controller_Action
@subpackage  MyHelperAction

or

@category   My
@package    My_Controller_Action
@subpackage MyHelperAction

What if use namespace instead of '_'?

like image 822
JohnT Avatar asked Apr 06 '11 12:04

JohnT


People also ask

How do I add or remove a package?

Browse to the package you want to add, and then click Open. To remove an existing package, select the package in the Answer file pane that you want to remove. In the Properties pane, change the Action property to Remove. Note The packages must be added to the offlineServicing configuration pass.

How do I use a package in a require function?

If you are creating a Node.js module, you can use a package in your module by passing it as an argument to the require function. In package.json, list the package under dependencies.

How to add or remove a package in DISM?

Add Packages Offline Using DISM 1 Open Windows SIM. 2 To add a new package, click Insert on the main menu, and select Package (s). ... 3 To remove an existing package, select the package in the Answer file pane that you want to remove. ... 4 Validate and save the answer file. See More....

How do I add or remove a package in inserton?

To add a new package, click Inserton the main menu, and select Package(s). Browse to the package you want to add, and then click Open. To remove an existing package, select the package in the Answer filepane that you want to remove.


1 Answers

First: If you use "_" or "\" (the namespace separator) should not influence your decision, how you annotate your classes. The underscore "_" comes from a pre-namespace age and "acts like" the namespace separator, except that it not create any namespaces. So "My_Controller_Action" should be treated as "Action" in "My_Controller".

However, how you use @package and/or @subpackage is really your decision. For example I dont use @category at all and @subpackage is everything after the "second" namespace. Let me explain: I follow the PSR-0 standard, where a package is structured into \<Vendorname>\<packagename>\<subpackage>\... (or "_" instead of "\", depending on the version). Then @package <vendorname>.<package> and @subpackage <subpackage>.

Conclusion: Its up to you :) A documentor may gerenate different structures of your code, depending on the tags you use and how you use them. Just try it out.

like image 68
KingCrunch Avatar answered Oct 17 '22 15:10

KingCrunch