Uploaded image for project: 'Moodle Community Sites'
  1. Moodle Community Sites
  2. MDLSITE-5556

Coding style: PHPDoc Type: type[] mentioned but not clear.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: Coding style
    • Labels:
      None

      Description

      The docs (https://docs.moodle.org/dev/Coding_style#Types) say:

      • When multiple occurrences of a given "type" are used, it's highly recommended to document them as type[] instead of the simpler and less informative "array" alternative.

      The definition of "multiple occurrences" is not clear enough, type[] is simply defines an array of elements of given type, (e.g. int[] or stdClass[]). I suggest to rephrase in a way:

      When value represented as array of given type, it's highly recommended to document them as type[] instead of the simpler and less informative "array" alternative (e.g. int[] or stdClass[]).

      While you are changing that part of wiki anyway, I think it could be useful to add the example of using pipe for multiple types:

      • When multiple different types are possible, they must be separated by a vertical bar (pipe) (e.g. @return int|false)

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            kabalin Ruslan Kabalin
            Participants:
            Component watchers:
            Marina Glancy, Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: