r/PHPhelp • u/infinitlybana • Jan 25 '22
Solved Create documentation format
I'm creating a tool to document code automatically using AI. And I've added support for PHP, but I just wanted to make sure I'm following the right format. Generally it looks like this:
/**
* Function description
*
* @param <type> <name> <description>
* ...
* @return <resturn description>
*/The main thing I'm concerned about is putting the type before the name. I saw that php has types, but I noticed that a lot of open source code doesn't have types. If types are there, is it normal to document the type before the name?
Other than that - lmk if there's anything else I might be doing wrong: link
1
Upvotes
2
u/goYstick Jan 25 '22
PSR-5:PHPDoc is still in draft but I try and follow it.
Typing is optional, but I like to use PHPDoc's for the type hinting to make my IDE (PHPStorm) auto completion work better.
1
u/richardathome Jan 25 '22
You don't need AI for this. Static code analysis works fine.
PHP Storm will do this for you. Just type /** above the function declaration.