I can't find anything saying in PSR about where should placed comment about class and namespace. Is it should be first description of class or namespace?
<?php
/**
* Some description about this class
*
* @author Mr. Anderson
* @since 06/09/17
* @package
*
*/
namespace MyNamespace;
class MyClass
{
}
Or properly that?
<?php
namespace MyNamespace;
/**
* Some description about this class
*
* @author Mr. Anderson
* @since 06/09/17
* @package
*
*/
class MyClass
{
}
PSR
has nothing to do with this.PSR
says nothing about docblocks.What really matters is the way that your comments are treated by
phpdoc
:is treated like you have a comment for a file, but don't have a comment for an exact class
MyClass
, so after generating documentation there will be an error that you don't have a class description.In second case:
phpdoc
will consider docblock as comment to a classMyclass
, but will not find comment to a full file. So you will still have an error after generating docs.But, with both of this approaches I would select second, because it is better to have class description, then file description.