07-16-2008, 09:42 PM
|
#1 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Location: England, UK
Posts: 83
Thanks: 3
|
Coding Standards
We need to make a decision on this before any code is written - and we all want to get started.
Below is my natural way of coding - there will almost certainly be parts you disagree on and will want to change. Post what you would do differently. We will work on the code type that is most popular - simply so most of us aren't working differently than the way we would normally - unless it could be more efficient to use a different format (conditionals etc.).
PHP Code:
<?php
/**
* Multi line comment/docblock
* 5 spaces / tab
*/
/**
* @class MyClass
* @final
*/
final class MyClass{
private $config;
/**
* Constructor
* @param array Argument array
*/
public function __construct($args){
if(count($args) < 10 && !is_object($args)){
die('lolage');
}
(is_array($args)) ? echo('foo') : echo('bar');
}
}
?>
(May expand on tomorrow, this was a quick one).
As for tabs/spaces any decent editor will convert tabs to spaces for you. I've recently started using NetBeans for Java, and then found a PHP plugin to use with it. This supports tabs to n spaces. Tabs display differently so I propose we use spaces as standard for indetation.
|
|
|
|