Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-61593

Coding style for return types

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.4.1, 3.5
    • Fix Version/s: None
    • Component/s: Policy
    • Labels:
      None
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE

      Description

      PHP 7.0 onwards support return type declarations which I feel we should encourage in new APIs.

      We need to confirm the coding style of these.

      Examples:

          public static function get_reason() : string {
          }
       
          public static function get_reason(): string {
          }
       
          public static function get_reason():string {
          }
       
          public static function get_reason() :string {
          }
      

      My personal preference is for the first example, which has one space before, and one space after the colon.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: