PSR doc comments

6k views Asked by At

Is there a documentation about the psr standards for doc comments in php.

example:

/** @var string $str */
$str = "test";
/** @var array $arr */
$arr = [];

is this allowed or do I need to do it like this:

/** @var string $str */
$str = "test";

/** @var array $arr */
$arr = [];
1

There are 1 answers

1
thexpand On BEST ANSWER

PSR does not recommend anything about the kind of comments you are talking about. Personally, I would recommend you to use the second one, because it is easier to read.

If you are interested in other PSR annotations and commenting standards, you can check them here, at GitHub under the "Commenting Code" section of the page.