php - Why does phpDoc opening sequence have two stars in `/**` instead of just `/*`
799
Things seem quite visually and machine-parseably clear with just/*
https://phpdoc.org/docs/latest/getting-started/your-first-set-of-documentation.html should say something about this, but doesn't.
Your thoughts?
Answer
Solution:
There is a difference between a regular php comment (
/* ... */
) and a DocBlock (/** ... */
) (or PHPDoc).PHP Interprets both as comments, however when using IDE's - they can parse the DocBlocks and provide you a better programming experience (with type-hints and autocomplets), and if you want you can use them to export a complete documentation of your code (packages/classes/functions/etc).
If you take for example this code:
You can see that the function
myFunction
doesn't return anything (@return void
) and it only accepts one parameter ($myArgument
) which supposed to be a string.To export a complete documentation you can use the phpDocumentor tool.