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

https://docs.moodle.org/dev/Coding_style does not document how to format closures and anonymouse functions

    XMLWordPrintable

    Details

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

      Description

      For example, I believe that the following is correct indentation:

      $sections[] = new chooser_section('questions', new lang_string('questions', 'question'),
              array_map(function($qtype) use ($context) {
                  return new qbank_chooser_item($qtype, $context);
              }, $real));
      

      However, CiBoT/CodeChecker gives a warning about this. It wants:

      $sections[] = new chooser_section('questions', new lang_string('questions', 'question'),
          array_map(function($qtype) use ($context) {
              return new qbank_chooser_item($qtype, $context);
          }, $real)
      );
      

      The Documentation should make the correct style clear, and then possibly we also need a separate issue about fixing CodeChecker.

        Attachments

          Activity

            People

            Assignee:
            poltawski Dan Poltawski
            Reporter:
            timhunt Tim Hunt
            Participants:
            Component watchers:
            Marina Glancy, Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated: