? ? Success

User tests: Successful: Unsuccessful:

avatar nonumber
nonumber
4 Mar 2015

This series of Pull Requests improve some basic code styles.
Mostly if/else syntax improvements, focussing on removing else statements which follow returns (or continues in loops).
Also de-nesting of if structures by adding early returns/elses.

Example:

function foobar($foo, $bar)
{
   if($foo > $bar)
   {
      return $foo;
   } else {
      return $bar;
   }
}

Can be changed to:

function foobar($foo, $bar)
{
   if($foo > $bar)
   {
      return $foo;
   }

   return $bar;
}

PS: This only illustrates the 'issue' with the useless else statements.

Current PRs in this series:

avatar nonumber nonumber - open - 4 Mar 2015
avatar joomla-cms-bot joomla-cms-bot - change - 4 Mar 2015
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 4 Mar 2015
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 6 Mar 2015
Title
 Edit Edit Improved syntax: elses after returns/continues [com_checkin]
Edit Edit Improved syntax: elses after returns/continues [com_checkin]
avatar zero-24 zero-24 - change - 6 Mar 2015
Category Code style
avatar nonumber nonumber - change - 7 Mar 2015
Title
Edit Edit Improved syntax: elses after returns/continues [com_checkin]
Edit Edit Improved syntax: Reducing use of else statements, adding early returns [com_checkin]
avatar nonumber nonumber - change - 8 Mar 2015
Title
Edit Edit Improved syntax: Reducing use of else statements, adding early returns [com_checkin]
Improved syntax: Reducing use of else statements, adding early returns [com_checkin]
avatar nonumber nonumber - change - 8 Mar 2015
Title
Improved syntax: Reducing use of else statements, adding early returns [com_checkin]
[CODE SYNTAX] Reducing use of else statements, adding early returns [com_checkin]
avatar nonumber nonumber - change - 8 Mar 2015
Title
[CODE SYNTAX] Reducing use of else statements, adding early returns [com_checkin]
[CODE STYLE] Reducing use of else statements, adding early returns [com_checkin]
avatar nonumber nonumber - change - 8 Mar 2015
Title
[CODE SYNTAX] Reducing use of else statements, adding early returns [com_checkin]
[CODE STYLE] Reducing use of else statements, adding early returns [com_checkin]
avatar yvesh yvesh - test_item - 14 Mar 2015 - Tested successfully
avatar yvesh
yvesh - comment - 14 Mar 2015

Haven't had any problems during testing and overlooking the code - you could do even some more cleanup though ;-)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6305.
avatar nonumber
nonumber - comment - 14 Mar 2015

Yes, this is just a first run. Only tackling certain types of code. Small steps. Small steps. :)

avatar brianteeman brianteeman - change - 23 Jun 2015
Labels Added: ?
avatar nonumber
nonumber - comment - 21 Jul 2015

If this doesn't find any interest within a week or 2, I'll close this PR and create new PRs with smaller fixes (one fix per PR).

avatar Duke3D
Duke3D - comment - 24 Jul 2015

@nonumber Patch seems to be redundant to 6301 with regard to changes to com_categories controller. Unable to apply this patch while patch 6301 is active. Should these patches be merged with each other for testing? Reverting 6301 and applying 6305 seems to work but not extensively tested. Please advise.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6305.

avatar Duke3D Duke3D - test_item - 24 Jul 2015 - Not tested
avatar nonumber
nonumber - comment - 24 Jul 2015

Thanks @Duke3D. Removed the com_categories changes. Should indeed not have been in this PR.

avatar nonumber
nonumber - comment - 10 Aug 2015

Due to lack of interest (read: not enough testing), this is now closed.

avatar nonumber nonumber - close - 10 Aug 2015
avatar nonumber nonumber - change - 10 Aug 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-08-10 18:22:33
Closed_By nonumber
avatar nonumber nonumber - close - 10 Aug 2015
avatar nonumber nonumber - head_ref_deleted - 27 Oct 2015

Add a Comment

Login with GitHub to post a comment