Details

      Description

      When I have the following code (un-indented on purpose):

      <?php
      $test = 'modeA';
      switch($test)
      {
      case 'modeA':
      // Do something
      break;
      case 'modeB':
      // Do other thing
      break;
      default:	// This includes the X option too
      // Do default thing
      break;
      }
      ?>
      

      It should format like this:

      <?php
      $test = 'modeA';
      switch($test)
      {
      	case 'modeA':
      		// Do something
      		break;
      	case 'modeB':
      		// Do other thing
      		break;
      	default:	// This includes the X option too
      		// Do default thing
      		break;
      }
      

      But it gets formatted like this instead:

      <?php
      $test = 'modeA';
      switch($test)
      {
      	case 'modeA':
      	// Do something
      		break;
      	case 'modeB':
      	// Do other thing
      		break;
      	default:
      	// This includes the X option too
      	// Do default thing
      		break;
      }
      

      Apparently it's not "allowed" to have comments in the same line as the 'case', but this would be helpful as one can include info on what it should match. The comments inside the case should be aligned to where the code is aligned (one tab to the right of the case word).

        Activity

        Hide
        Shalom Gibly added a comment -

        Fixed on 'development' (3.1)

        Show
        Shalom Gibly added a comment - Fixed on 'development' (3.1)
        Hide
        Axel Pardemann added a comment - - edited

        Just testing it today it's only half resolved, I tried the test code and it formats like this:

        <?php
        $test = 'modeA';
        switch($test)
        {
        	case 'modeA':
        		// Do something
        		break;
        	case 'modeB':
        		// Do other thing
        		break;
        	default:
        		// This includes the X option too
        		// Do default thing
        		break;
        }
        ?>
        

        Which is partially ok as the "case same line comment" is still pushed to the next line instead of just leaving it there as a comment for the case block.

        Show
        Axel Pardemann added a comment - - edited Just testing it today it's only half resolved, I tried the test code and it formats like this: <?php $test = 'modeA'; switch($test) { case 'modeA': // Do something break; case 'modeB': // Do other thing break; default: // This includes the X option too // Do default thing break; } ?> Which is partially ok as the "case same line comment" is still pushed to the next line instead of just leaving it there as a comment for the case block.
        Hide
        Clayton Headley (Inactive) added a comment -

        Verified this is still happening as Axel commented. Comment lines are not left on any line with a case are moved to below the case line. If this is the expected behavior this ticket can be closed.

        Show
        Clayton Headley (Inactive) added a comment - Verified this is still happening as Axel commented. Comment lines are not left on any line with a case are moved to below the case line. If this is the expected behavior this ticket can be closed.
        Hide
        Shalom Gibly added a comment -

        The way I see it, is that he main issue in this ticket was resolved, and Axel's last comment can be pushed as a new 'improvement' ticket.
        Right now, the formatting acts as it was designed (moving the comment down).

        @Axel - Please add a new enhancement if you can

        Show
        Shalom Gibly added a comment - The way I see it, is that he main issue in this ticket was resolved, and Axel's last comment can be pushed as a new 'improvement' ticket. Right now, the formatting acts as it was designed (moving the comment down). @Axel - Please add a new enhancement if you can
        Hide
        Axel Pardemann added a comment - - edited

        Done! I've opened an improvement issue for this. It's the APSTUD-4465 issue.

        This can be closed then.

        Show
        Axel Pardemann added a comment - - edited Done! I've opened an improvement issue for this. It's the APSTUD-4465 issue . This can be closed then.
        Hide
        Shalom Gibly added a comment -

        Thanks!

        Show
        Shalom Gibly added a comment - Thanks!

          People

          • Assignee:
            Shalom Gibly
            Reporter:
            Axel Pardemann
          • Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development