Skip to content

Commit

Permalink
Storing plugin version in a class constant
Browse files Browse the repository at this point in the history
  • Loading branch information
GeertDD committed Aug 19, 2013
1 parent 86ecda6 commit 4d629b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin-name/class-plugin-name.php
Expand Up @@ -24,9 +24,9 @@ class Plugin_Name {
*
* @since 1.0.0
*
* @var string
* @const string

This comment has been minimized.

Copy link
@GaryJones

GaryJones Aug 26, 2013

Contributor

There has never been a @const tag for PHPDoc. The ideal is the as-yet-unsupported @type tag, or more likely the default @var.

This comment has been minimized.

Copy link
@GeertDD

GeertDD Aug 26, 2013

Author Contributor

This comment has been minimized.

Copy link
@GaryJones

GaryJones Aug 26, 2013

Contributor

It's not part of the legacy phpDocumentor docs: http://manual.phpdoc.org/HTMLframesConverter/default/
It's not part of the current phpDocumentor docs: http://www.phpdoc.org/docs/latest/index.html
It's not listed in the list of tags on Wikipedia: http://en.wikipedia.org/wiki/PHPDoc#Tags
It's not listed in the PHP-FIG draft PSR: https://github.com/phpDocumentor/phpDocumentor2/blob/develop/docs/PSR.md#822-type

The only "official" place it's listed (stackoverflow doesn't count) is phpdoc.de, but the spec there only ever made it to 1.0beta, and the site also includes tags like @brother and @sister, which I've never seen used before, so the overall trust in that site is somewhat diminished ;-)

In short, even if some unofficial standard does mention it, if the documentation generators don't support it, then it's not worth using. @var is correct for now, and once the PSR is out of draft, and is the basis for which phpDocumentor, Doxygen, APIGen and others are understanding PHPDoc, then @type would be correct.

This comment has been minimized.

Copy link
@GeertDD

GeertDD Aug 26, 2013

Author Contributor

👍 You did your research. It'd be cool if you posted this on StackOverflow too.

This comment has been minimized.

This comment has been minimized.

Copy link
@GeertDD

GeertDD Aug 26, 2013

Author Contributor

And upvoted :-)

*/
protected $version = '1.0.0';
const VERSION = '1.0.0';

/**
* Unique identifier for your plugin.
Expand Down

1 comment on commit 4d629b5

@GaryJones
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Furthermore, while this has been changed to a constant, it's former $this->version is still used when enqueueing scripts and styles.

Please sign in to comment.