mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-13 01:03:57 +02:00
Updated phpdoc stuff
This commit is contained in:
@@ -16,15 +16,15 @@ Below is an example of how you might document a class with a few methods;
|
|||||||
/**
|
/**
|
||||||
* @author A Name <a.name@example.com>
|
* @author A Name <a.name@example.com>
|
||||||
* @link http://www.phpdoc.org/docs/latest/index.html
|
* @link http://www.phpdoc.org/docs/latest/index.html
|
||||||
* @package helper
|
|
||||||
*/
|
*/
|
||||||
class DateTimeHelper
|
class DateTimeHelper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param mixed $anything Anything that we can convert to a \DateTime object
|
* @param mixed $anything Anything that we can convert to a \DateTime object
|
||||||
*
|
*
|
||||||
* @return \DateTime
|
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
*/
|
*/
|
||||||
public function dateTimeFromAnything($anything)
|
public function dateTimeFromAnything($anything)
|
||||||
{
|
{
|
||||||
@@ -59,10 +59,9 @@ class DateTimeHelper
|
|||||||
}
|
}
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
The documentation for the class as a whole firstly has the [@author] tag, this tag is used to document the author of
|
The documentation for the class as a whole has the [@author] tag and a [@link] tag. The [@author] tag is used to
|
||||||
the code and can be repeated for documenting several authors. Secondly is the [@link] tag, used to link to a website
|
document the author of the code and can be repeated for documenting several authors. The [@link] tag is used to link to
|
||||||
indicating a relationship between the website and the code. Thirdly it has the [@package] tag, used to categorize the
|
a website indicating a relationship between the website and the code.
|
||||||
code.
|
|
||||||
|
|
||||||
Inside the class, the first method has an [@param] tag documenting the type, name and description of the parameter
|
Inside the class, the first method has an [@param] tag documenting the type, name and description of the parameter
|
||||||
being passed to the method. Additionally it has the [@return] and [@throws] tags for documenting the return type, and
|
being passed to the method. Additionally it has the [@return] and [@throws] tags for documenting the return type, and
|
||||||
@@ -78,7 +77,6 @@ results in the same (no return) action.
|
|||||||
[PHPDoc manual]: http://www.phpdoc.org/docs/latest/index.html
|
[PHPDoc manual]: http://www.phpdoc.org/docs/latest/index.html
|
||||||
[@author]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/author.html
|
[@author]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/author.html
|
||||||
[@link]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/link.html
|
[@link]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/link.html
|
||||||
[@package]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/package.html
|
|
||||||
[@param]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/param.html
|
[@param]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/param.html
|
||||||
[@return]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/return.html
|
[@return]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/return.html
|
||||||
[@throws]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/throws.html
|
[@throws]: http://www.phpdoc.org/docs/latest/references/phpdoc/tags/throws.html
|
||||||
|
Reference in New Issue
Block a user