Welcome Guest, Not a member yet? Register   Sign In
Good reference for learning PHPDoc?
#3

There are two draft PSRs:
https://github.com/php-fig/fig-standards.../phpdoc.md
https://github.com/php-fig/fig-standards...oc-tags.md

From https://www.php-fig.org/psr/#draft

Quote:Why should we use it, where should it be used

Specifying Types is a good practice. It helps developers to understand code, reduce bugs, and helps static analysis or IDE.

In the old age, there is no type declaration in PHP:
https://www.php.net/manual/en/language.t...ations.php

So people used Doc comment, showing types as special comments.
@var, @param, @return, ...

Now PHP has type declaration, but not all the Doc comments cannot be specified as type declarations.
For example, if you don't use PHP 8.0 or later, you can't use Union Types:
https://www.php.net/manual/en/language.t...site.union

So when we can't specify types with type declaration, we still use PHPDoc.
Reply


Messages In This Thread
Good reference for learning PHPDoc? - by datamweb - 06-08-2022, 12:22 AM
RE: Good reference for learning PHPDoc? - by kenjis - 06-08-2022, 05:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB