Coding standard proposal
| From: | Dmitri | Date: | Sat, 19 Apr 2008 14:17:14 +0000 |
| Subject: | Coding standard proposal | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-49817@lists.php.net to get a copy of this message | ||
Hello!
I am not a pear developer, just a heavy user of PEAR classes
I think it will be a good idea to add some simple coding standard for variable naming.
hint a variable type in the first 2-4 letters of the variable
prefixes:
string: str
array: arr
object: obj
integer: int
boolean: bool
handle: hdl
function: fn
Follow the prefix with the CamelCase name of the variable, which should be descriptive
For example $arrFormData or $strFileName or $boolNotify
This will make it a lot easier to understand the code. Also phpDocumentor code can be modified to make use of this naming convention to automatically guess the type of variable,
for example if it sees a function like this fnParseEmail($strRawMessage, $boolExtractAttachment = false)
it can automatically add this to doc block
@param string $strRawMessage
@param boolean $boolExtractAttachment
I think adapting this standard will further improve the quality of pear classes and make it easier for users of these classes to understand the intentions of the developer of the class.
--
Open Source ALL content management
with streaming video
http://wiki.sharedlog.com