Re: private methods require an underscore
| From: | till | Date: | Sun, 25 Nov 2007 06:36:21 +0000 |
| Subject: | Re: private methods require an underscore | ||
| References: | 1 2 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-4608@lists.php.net to get a copy of this message | ||
On Nov 25, 2007 12:29 AM, Greg Sherwood <gsherwood@squiz.net> wrote:
>
> till wrote:
> > Hello QAers!
> >
> > phpcs frequenty complains with the following message:
> > Private method name "Foo::getS3AuthCode" must be prefixed with an underscore
> >
> > (getS3AuthCode is a private method in Foo.)
> >
> > I believe the underscore is redundant in PHP5 - kind of like @access
> > tags in phpdoc in php5 so I wouldn't use it, others suggested the
> > same. I don't want to just go ahead, because I want all the shiny CS
> > graphs to be at 0. ;-)
> >
> > Any advice? Or should I open a feature request? It could probably take
> > "PHP Version X" from the file comment and act based on that? (My first
> > guess to resolve this issue within phpcs.)
> >
> > Thanks and regards,
> > Till
> >
> Hi Till,
>
> PHP_CodeSniffer enforces the current PEAR Naming Convention standards
> that read, in part:
> "Private class members (meaning class members that are intented to be
> used only from within the same class in which they are declared; PHP
> does not yet support truly-enforceable private namespaces) are preceeded
> by a single underscore. For example: _sort() _initTree() $this->_status"
>
> (I can't seen to get to pear.php.net at the moment so I don't have the
> direct link for that standard)
(Me neither. :O)
> And as always, before the PEAR standard in PHP_CodeSniffer could be
> changed, the written PEAR standard would need to be changed.
OK, wasn't aware of all that. Well, I think this would need to be
"adjusted". :) How does one go about it? Like the formal process...
Thanks for your reply.
Till