Phpdocumentor: Processing private & protected class members not supported in Release v3.0.0-alpha.3 ?

Created on 15 Feb 2019  路  8Comments  路  Source: phpDocumentor/phpDocumentor

Hello there,

I try to use PHPDoc with a PHP7.3 project, and thus I need to generate a full doc for my classes.
I'm using the Release v3.0.0-alpha.3 for PHP7.0+ support
The parameter --parseprivate is used to include private properties & methods

Expected Behavior

Private & protected properties & methods should be listed

Actual Behavior

No way to get them listed. PhpDoc only get public ones.

Steps to Reproduce the Problem

class ConfActivity
{
     /**
     * @var string test - listed
     */
    public $test;

    /**
     * @var string test2 - not listed
     */
    private $test2;
}

Command line used:
php phpDocumentor.phar --parseprivate -d src/Entity -t docs/src/Entity

My environment

  • Version used: Release v3.0.0-alpha.3
  • Install method: Phar
  • php version: 7.3
  • Operating system and version: Debian 9
bug

Most helpful comment

Hello @mvriel !
Of course, you're right: I misunderstood the documentation ! Your solution is working.

A small difference compared to the doc however, if it can be useful:

php phpDocumentor.phar --visibility=public,private doesn't work (neither public nor private is displayed)
but
php phpDocumentor.phar --visibility=public --visibility=private works (both are displayed)

Thanks for your help !

All 8 comments

Checking this one

Hello @kershin, although the name of the option is admittedly confusing; the parseprivate option is meant to include any element tagged with @internal. By default elements tagged with @internal is not visible.

To include protected and private elements you can use the visibility option and provide a comma-separated list of which visibilities to include.

Can you try that and see if that solves your problem? I must admit I did notice a difference between my local setup and our CI environment; so I am still investigating this issue to see if it works as expected

Addendum: in case you are wondering, the parseprivate option exists from the time when there were no visibility specifiers in PHP. In that age, you could only limit which elements were parsed by using the @internal tag.

Hello @mvriel !
Of course, you're right: I misunderstood the documentation ! Your solution is working.

A small difference compared to the doc however, if it can be useful:

php phpDocumentor.phar --visibility=public,private doesn't work (neither public nor private is displayed)
but
php phpDocumentor.phar --visibility=public --visibility=private works (both are displayed)

Thanks for your help !

Windows10/PHP 7.3.3/phpDocumentor v3.0.0-alpha.3

I've been trying to get phpDocumentor to document private class members with no luck either. I tried both formats that @kershin suggested but no luck. The only version I could get working was 2.9.0 and although it documented the private members, it also generated a massive amount of warnings in the resulting html.

Any suggestions?

Please try the version from develop. We need to prepare a new release since a lot has been fixed at develop. But I didn't have time yet to do so.

Second solution from @kershin worked for me on dev-develop version.

On the latest version of develop I have now also made the first solution work. When I implemented this item I was under the impression that Symfony/Console would handle it in the way that is documented. I have added a bit of extra handling now that enabled both methods of specifying visibility.

Because the issue seems to be resolved with this change I will be closing the issue. Please note that this is not dealt with on dev-master or the 2.x series of phpDocumentor

Was this page helpful?
0 / 5 - 0 ratings