? Pending

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
11 Oct 2020

Summary of Changes

Remove unnecessary local variable

Assigning a value to a variable that is otherwise unused apart from returning is bad practice and increases the memory used by PHP and should be avoided.

Testing Instructions

Code review

avatar PhilETaylor PhilETaylor - open - 11 Oct 2020
avatar PhilETaylor PhilETaylor - change - 11 Oct 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 11 Oct 2020
Category Front End Plugins
avatar PhilETaylor PhilETaylor - change - 11 Oct 2020
Title
Unnecessary local variable
[4] Unnecessary local variable
avatar PhilETaylor PhilETaylor - edited - 11 Oct 2020
avatar PhilETaylor
PhilETaylor - comment - 11 Oct 2020

There are 84 more of these but I got bored. Apparently the extra overhead of memory use is nil in defining a var before immediately returning it... in a unscientific test ... https://stackoverflow.com/questions/5971090/how-does-php-assign-and-free-memory-for-variables

even though phpStorm moans about it..

Screenshot 2020-10-11 at 21 41 22

avatar PhilETaylor PhilETaylor - change - 11 Oct 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-10-11 20:41:40
Closed_By PhilETaylor
Labels Added: ?
avatar PhilETaylor PhilETaylor - close - 11 Oct 2020
avatar chmst
chmst - comment - 12 Oct 2020

Having a variable before return makes debugging easier. So thanks for closing.

Add a Comment

Login with GitHub to post a comment