@access private Should exclude methods
AriMcBrown opened this issue · 10 comments
@access private Should exclude methods, this currently only works on fields.
This is very usefull if I want to exclude something as: __uglyPrivateFunctionName($with, $to, $much, $parameters)
Hi McBrown,
This should already work as expected, any method with the "@access private" tag or with a name starting with an underscore will be parsed as having private access and only added to the object graph if the option to show private items is set.
Make sure that you have the option set and have added the tag correctly. Do you have example code that causes the problem for you?
Hi Peej,
Code http://pastebin.com/F4fsxqsk
And I've tried numerous config combinations
Which config should result as I want? because it does work for private fields. Just not for methods
Ah I see. Constructors are a special case as they can never be private since they are used to create an object instance.
Then to followup with a silly question, what do I need to do to show the __constructor(php5 style) as an constructor in the documentation? I've tried numerous tags, but it keeps putting the constructor with the methods.
This feature is not properly working. Classes and constructors are not hidden when used with this taglet!
@mcbrown: Just name your constructor __construct() or the name of the class and PHPDoctor will treat is as a constructor.
@redshadow159: Classes and constructors cannot be private in PHP so there is no support for this in PHPDoctor. Adding the ability to mark classes as private may be useful to emulate inner classes. Do you think this'd actually be a useful function?
What I wrote: http://pastebin.com/TffZfSdp How I get it and how I want it: http://tinyurl.com/wsconnector-wsdata-constructor (the left is generated by me, the right is the Smarty example given on the homepage).
@peej: I think this is why they use protected constructors that can only be invoked by their sub-classes. Very useful for building plugins. (Which I'm happening to work on right now)
By the way, did I mention I'm using it for my final thesis? ;)
I remember now. Yes you are correct. However, I (we) removed the separate constructor section from the standard doclet a while back since it can only ever contain a single item as (unlike Java) PHP can only have 1 constructor per class (the Smarty API documentation on the PHPDoctor site is quite old).
If protected constructors are a common thing then it makes sense to allow the @Protected tag.
Edit: Actually it already does this, you can use the @Protected or @Private tags or respective PHP5 keywords with a constructor and it works the same as with a regular method.
I know, it treats the constructors as a normal method, so this is not a problem. But isn't a constructor a fundamental different thing, which should deserve a own section. (since it can only be invoked on construction)