The Magento ECG Coding Standard seems to be (at least kind of) official as standard for Magento 1 extensions:
https://github.com/magento-ecg/coding-standard
But I don't understand the reasoning behind all rules, and the code sniffer rules with their messages alone do not help much. Is there any detailed documentation about the standard? I know the common best practices and the developers guide but cannot find anything specific about these coding standards.
What troubles me most is the strictness about not using PHP functions.
For example: Why is every single file system related PHP function forbidden?
I guess, you are supposed to use Varien_Io_File, Varien_File_Object etc. but even the core developers are not aware of all the Varien classes and you often find things like in Mage_ImportExport_Model_Import_Adapter_Csv:
$this->_fileHandler = fopen($this->_source, 'r');
So, the core is not the best example, as often.
Other IMHO questionable forbidden functions:
mb_parse_strparse_strparse_urlbase64_decode- yeah, it's used in backdoors but banning
evalshould be enough and there are legit use cases, like encoding binary data. And other thanjson_decode(which is not forbidden) there is no core helper available for this.
- yeah, it's used in backdoors but banning
Essentially, my question boils down to: Where is this standard documented? And/or is there a list of "things to use instead of these native PHP functions"?
Zend_Dbquery builder be capable of generating any SQL queries?selectstatement throughZend_Dbusing raw SQL as input? I assumed that's what github.com/kalenjordan/custom-reports does in the backend.