I've become a bit of pain when it comes to code styling these days. Things like:
- Ensuring indents are used with tabs and aligned correctly
- Ensuring control structure opening and closing brackets are on new lines
- Use single quotes when possible rather than double quotes
- Variables are defined like so:
Correct:
$app = JFactory::getApplication();
$jinput = $app->input;
Incorrect:
$jinput = JFactory::getApplication()->input;
I deem the second one incorrect as $jinput
has been defined, however if you need to use $app
again, then you will need to call JFactory::getApplication()
again which is pointless. So simply define it once, then anything after it can be based on the $app
variable.
I find it simply looks much cleaner and it better coding practice.
So now to the question bit. When we (those who agree with the above) see answers that do not adhere to these types of coding practices, do we (can we) edit them accordingly?
Some may not be bothered which is perfectly fine but for those that are, would everyone agree that it's fine to edit these answers?
$app
once again, I prefer to define$jinput
directly.$app
for more normally gets used more than once