Page 1 of 1

PHP Style Guide

Posted: Fri Nov 21, 2014 2:54 am
by clorne
I have looked carefully but not found yet to see if OpenCart has adopted one of the PHP style guides. (My apologies if it has)

For example

PSR-0: Autoloader Standard
PSR-1: Basic Coding Standard
PSR-2: Coding Style Guide

Zend coding standard ... rview.html

Pear coding standards [url][/url]

Other frameworks I've used are quite strict Magento and concrete5 to name just two

It would seems useful if everyone sang by the same hymn sheet.

Re: PHP Style Guide

Posted: Fri Nov 21, 2014 4:12 am
by uksitebuilder

Re: PHP Style Guide

Posted: Fri Nov 21, 2014 3:51 pm
by clorne
Thanks, missed that. Interesting, I will try to use it and watch for future developments.

Re: PHP Style Guide

Posted: Sat Nov 29, 2014 4:53 am
by Dhaupin
OpenCart code is pretty dang consistent -- except for the part about whitespace:
Whitespace -
After any code, but before a new line - there should be no white space. The same is true for an empty line. After the closing PHP tag it is extremely important to remove any white space.
Theres prob 2000 extra spaces/tabs scattered everywhere. Worse yet certain hasty vQmods use a trailing whitespace in their search targets (ouch). Mind your whitespace all :)