Development talk:Coding style: Difference between revisions
From MoodleDocs
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
Should we enforce the PHP5 constructor __construct() instead of $classname() [[User:Nicolas Connault|Nicolas Connault]] 19:55, 19 May 2009 (UTC) | Should we enforce the PHP5 constructor __construct() instead of $classname() [[User:Nicolas Connault|Nicolas Connault]] 19:55, 19 May 2009 (UTC) | ||
:+1. I think we agreed about that some time ago (when igniting some 2.0 developments) --[[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] 00:03, 20 May 2009 (UTC) | |||
---- | |||
About comments... I have been using since ages ago "///" with outer alignment (I think that it was caused by some agreement long time ago, not my decision), for example: | |||
<code php> | |||
function check_moodle_environment(..., ..., ..., ...) { | |||
$status = true; | |||
/// This are cached per request | |||
static $result = true; | |||
static $env_results; | |||
static $cache_exists = false; | |||
/// if we have results cached, use them | |||
if ($cache_exists) { | |||
$environment_results = $env_results; | |||
/// No cache exists, calculate everything | |||
} else { | |||
/// Get the more recent version before the requested | |||
if (!$version = get_latest_version_available($version, $env_select)) { | |||
$status = false; | |||
} | |||
.... | |||
.... | |||
</code> | |||
Is that allowed, or only the "//" with inner alignment as commented at [[Development:Coding style#Inline comments|inline comments]] --[[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] 00:03, 20 May 2009 (UTC) |
Revision as of 00:03, 20 May 2009
Should we enforce the PHP5 constructor __construct() instead of $classname() Nicolas Connault 19:55, 19 May 2009 (UTC)
- +1. I think we agreed about that some time ago (when igniting some 2.0 developments) --Eloy Lafuente (stronk7) 00:03, 20 May 2009 (UTC)
About comments... I have been using since ages ago "///" with outer alignment (I think that it was caused by some agreement long time ago, not my decision), for example:
function check_moodle_environment(..., ..., ..., ...) {
$status = true;
/// This are cached per request
static $result = true;
static $env_results;
static $cache_exists = false;
/// if we have results cached, use them
if ($cache_exists) {
$environment_results = $env_results;
/// No cache exists, calculate everything
} else {
/// Get the more recent version before the requested
if (!$version = get_latest_version_available($version, $env_select)) {
$status = false;
}
....
....
Is that allowed, or only the "//" with inner alignment as commented at inline comments --Eloy Lafuente (stronk7) 00:03, 20 May 2009 (UTC)