User tests: Successful: Unsuccessful:
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.
Code review
Status | New | ⇒ | Pending |
Category | ⇒ | Front End Plugins |
Title |
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-10-11 20:41:40 |
Closed_By | ⇒ | PhilETaylor | |
Labels |
Added:
?
|
Having a variable before return makes debugging easier. So thanks for closing.
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..