Phpdocumentor: Using PHP keywords as method name

Created on 8 Jan 2019  路  4Comments  路  Source: phpDocumentor/phpDocumentor

I want to document a class (the link to the project exists in the Environment section) that has a method named JSON::isSet(). When I want to document it using phpDocumentor, the following error will be shown and the documentation will not be created successfully:

Parse Error: Syntax error, unexpected T_ISSET, expecting T_STRING on line 307 No summary was found for this file

Since PHP methods are case-insensitive, maybe phpDocumentor think the method as JSON::isset(), a PHP keyword. It may think a PHP keyword as method name is an error; however, as of PHP7, it is possible to do that (see this RFC).

How to overcome the problem? Is there any quick fix for this?

__Note__: When I comment the JSON::isSet() definition or I change its name to something else (e.g. JSON::is_set()) and run the same command, the documentation will be created successfully.

Environment

needs author update

Most helpful comment

This issue is fixed with #2056

All 4 comments

Hi,

Thanks for you report. I thing you have to switch to phpdoc v3. We had issues like this we could not fix in phpdoc v2. V3 is still in alpha phase but should be stable enough to handle a library like yours.

Please let me know if this solves your issue.

Hi, @jaapio!
Thanks for the new version. The problem fixed. However, it doesn't import protected methods in the documentation.

This issue is fixed with #2056

Thanks! I'll check. :smiley:

Was this page helpful?
0 / 5 - 0 ratings