1

Hi everyone I'm in the process of learning php and I keep running into this convention of comments with an @sometoken within it.

example 1

 /**
 * Parses the contents of all pages
 *
 * @see DummyPlugin::onSinglePageLoaded()
 */

example 2

 /**
 * Create pagination object for the page.
 *
 * @param Event $event
 */

What is the purpose of this convention?

  • not a duplicate since this is about @ in COMMENTS, but I've not seen this and no clue what it is supposed to signify. – Duane Lortie Aug 29 '16 at 15:14
  • @DuaneLortie It is a duplicate. The duplicate question also deals with `@` in comments, and fully explains this situation. – ceejayoz Aug 29 '16 at 15:37

2 Answers2

1

To put it simple these tags will be used to create an automated documentation of your code. Also it helps you if you use a current IDE, which will display helpful information. You can get more info here.

Philipp Palmtag
  • 1,310
  • 2
  • 16
  • 18
0

Those are tags for PHPDocumentor, a PHP-specific descendant of JavaDoc. You'll find most popular languages have a *Doc of their own, including JSDoc and CSSDOC.

The tags were originally used to generate static HTML guides outlining all the classes, methods, and data types used in a program. But those got unwieldy, and IDEs got better to the point where today the tags are meant for humans to read when working on the code and our tools can use them to give us hints and documentation as we're interfacing with well-documented code.

Dave Ross
  • 3,313
  • 1
  • 24
  • 21