Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5248

Allow inline comments describing variables

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.7
    • Fix Version/s: None
    • Component/s: Local: Code checker
    • Labels:
    • Affected Branches:
      MOODLE_27_STABLE

      Description

      Right now phpdocs comments within code are 100% forbidden, and the code-checker always report them that way with message:

      Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
      

      But they are useful, especially for IDEs, helping them to find the type (class) of a given variable and its methods, attributes.

      So this is about to consider when we could whitelist declarations of this type:

      /** @var type $name */
      $name = something_that_retuns_a_type();
      

      A.k.a, a inline phpdoc comment describing a variable immediately followed by an assignment to that variable.

      One example (out from lots), that caused this to be created:

      https://tracker.moodle.org/browse/MDL-46051?focusedCommentId=304616&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-304616

      To be discussed before implementation, ciao

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              moodle.com, Eloy Lafuente (stronk7)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: