Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct way to write PHPDocs for constants?

Tags:

php

phpdoc

I have this code:

/**  * Days to parse  * @var int  */ const DAYS_TO_PARSE = 10; ... 

I don't think that using @var is correct for a constant and I don't see any @constant PHPDoc tag. What is the correct way to do this?

like image 684
Elzo Valugi Avatar asked Jul 15 '11 11:07

Elzo Valugi


1 Answers

The PHP-FIG suggests using @var for constants.

7.22. @var

You may use the @var tag to document the "Type" of the following "Structural Elements":

  • Constants, both class and global scope
  • Properties
  • Variables, both global and local scope

Syntax

@var ["Type"] [element_name] [<description>]

like image 117
user2983026 Avatar answered Sep 27 '22 20:09

user2983026