Problem/Motivation

Inline @var comments are useful for some IDEs to provide code complete feature for developers, such as PHPStorm.

But there is no standard about it as I know -- Checked API documentation and comment standards

In Drupal and contrib modules, I saw two styles are used, starts with /** @var and /*

Proposed resolution

As it's an inline comment, I suggest using /*

Pointed by @kaysenlau according to phpDocumentor, should use /** @var

class Foo
{
  /** @var string|null Should contain a description */
  protected $description = null;
}

Remaining tasks

  • Needs discussion
  • Replace all comments in core following the new unified standard
CommentFileSizeAuthor
2.png196.12 KBjungle
1.png178.84 KBjungle
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jungle created an issue. See original summary.

jungle’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)
Related issues: +#2305593: [policy] Set a standard for @var inline variable type declarations

Update summary and mark this as duplicate