开发者

phpDocumentor on legacy code

开发者 https://www.devze.com 2023-02-05 11:41 出处:网络
Can phpDocumentor be used to generate HTML docs for some legacy code that does not necessarily conform to its standard?

Can phpDocumentor be used to generate HTML docs for some legacy code that does not necessarily conform to its standard?

I'd like to generate s开发者_如何学Come preliminary documentation for an old code tree and later on start improving my comments and add the appropriate @ tags as I get fluent with phpDocumentor. I've never used this piece of software before and the examples I've found focus on how to write new code that conforms to its syntax and generate HTML file by file with the -f parameter.

I've installed latest phpDocumentor through the PEAR command line installer and tried this little *.bat file on Windows XP:

@echo off
phpdoc ^
    --directory "\\server\project\trunk" ^
    --target "C:\tests\project-doc"

... but this is all I get:

PHP Version 5.3.5
phpDocumentor version 1.4.3

Parsing configuration file phpDocumentor.ini...
   (found in C:\Archivos de programa\PHP\pear\data/PhpDocumentor/)...

done
Maximum memory usage set at 256M after considering php.ini...
using tokenizer Parser
directory: ''  not found

I've also tried mapping the UNC path to a drive letter:

@echo off
phpdoc ^
    --directory "I:\" ^
    --target "C:\tests\project-doc"

... but:

PHP Version 5.3.5
phpDocumentor version 1.4.3

Parsing configuration file phpDocumentor.ini...
   (found in C:\Archivos de programa\PHP\pear\data/PhpDocumentor/)...

done
Maximum memory usage set at 256M after considering php.ini...
using tokenizer Parser
a target directory must be specified
 try phpdoc -h

This error message is the same if I create "C:\tests\project-doc" before.

What's exactly wrong in my syntax?


phpDocumentor can indeed run against "undocumented" code. It builds its docs based on the code itself, and uses the docblocks as additional info (and additional organization, in the case of @package and @subpackage tags).

I'd suggest starting with phpDocumentor against your existing code, and work towards clearing out the warnings you see in the errors.html file that results -- this file is generated in the top level of your output docs, but there isn't any link to it from the output docs.

Once you have those cleared, you can start running phpDocumentor with the -ue argument (--undocumentedelements), which will add new warnings to errors.html, highlighting (in much greater detail) things that still need to be documented in docblocks.

Now, as for the issue you're having trying to run the program against code on a shared drive, I'm not sure what's wrong there. The script is clearly able to execute PHP and find the phpDocumentor code itself. You might try putting the arguments in the same line, rather than using the ^ as a line-feed escape character, and perhaps remove the quotes around the paths (since no spaces exist in the paths).


I think I've found what the issue is. The parameter parser is very picky and it doesn't like neither UNC paths nor bare root directories. If I replace this:

--directory "I:\"

... with this:

--directory "I:\."

... it finally starts running.

I suppose it's a bug. Their bug tracker doesn't seem to be public so I don't know if it's a known issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号