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

Coding style for return types

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 3.4.1, 3.5
    • Policy
    • None
    • MOODLE_34_STABLE, MOODLE_35_STABLE

      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.

            stronk7 Eloy Lafuente (stronk7)
            dobedobedoh Andrew Lyons
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.