Re: Naming convensions
| From: | Klaus Guenther | Date: | Wed, 03 Aug 2005 18:12:51 +0000 |
| Subject: | Re: Naming convensions | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-39172@lists.php.net to get a copy of this message | ||
On 8/3/2005 7:40 PM, Stoyan Stefanov spake the following words:
>Hi guys,
>
>I was just looking at the changelog for Net_Curl (Great job, BTW!
>setOptions() and getInfo() were really needed). I saw this entry:
>
>- Fixed coding standards, which included variable name changes (ie.
>http_headers to httpHeaders)
>
>I think both $some_var and $someVar are acceptable, there's no strict
>rule for the variables stated here
>http://pear.php.net/manual/en/standards.naming.php
>
>Is it OK for a PEAR package to use $some_var?
>
>
My understanding is that it really shouldn't be OK, but some people do
it anyway. However, you can't BC break in packages > 1.0.0-stable. So
I'm not sure exactly what should be done here :)
>Another thing - the naming conventions doc state that global vars
>should start with an underscore followed by the package name, like
>$_PEAR_whatever or $_PEAR_destructor_object_list. But the example
>(http://pear.php.net/manual/en/standards.sample.php) doesn't have an
>underscore ($GLOBALS['NET_SAMPLE_Count'] = 0) and in addition it
>capitalizes the package name and the first letter of the
>after-package-name part. To me, this should be:
>$GLOBALS['Net_Sample_count'] = 0;
>because it is consistent with the package naming convention, the
>$some_vars naming and the $_PEAR_destructor_object_list example,
>mentioned in the naming convention manual entry
>(http://pear.php.net/manual/en/standards.naming.php, very bottom)
>
Hmm. I don't use globals in my packages, but I think you're absolutely
right here.
Klaus