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

Review some break statements that maybe should be continue 2

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.6
    • Fix Version/s: None
    • Component/s: Gradebook
    • Labels:
      None
    • Affected Branches:
      MOODLE_36_STABLE

      Description

      This is a followup of MDL-63422 where, aiming to get PHP 7.3 working, all the switch / case / continue occurrences in core was reviewed.

      The policy followed was:

      • if possible, take rid of the continue (all activity modules), keeping original behavior.
      • when the intention clearly was to jump to next element in loop, change to continue 2.
      • when it was not clear, no matter the exiting continue there is (was) non-sense... change it to break that behaves exactly the same.

      And, as result of it some changes were applied to both grade/querylib.php and lib/gradelib.php, following the 3rd point in the policy above.

      Commit: https://github.com/stronk7/moodle/commit/2b655b85834abd757027a2e61eab3cb7a292a2d3#diff-53295022f0e8fb89ab3469d96f3eb508

      This is about to review if those new break; statements are really what we want there or it would be better to change to a continue 2 that would lead to the next iteration, not executing all the remaining code in the loop after the switch.

      To be analyzed. As said, the change performed was to keep original behavior (just end the switch). This is about to verify if we can go a step further and end the iteration (the original continue; used there, maybe was meant to do so.

      Ciao

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                stronk7 Eloy Lafuente (stronk7)
                Participants:
                Component watchers:
                Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: