Re: private methods require an underscore
| From: | Greg Sherwood | Date: | Sun, 25 Nov 2007 06:29:15 +0000 |
| Subject: | Re: private methods require an underscore | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-4607@lists.php.net to get a copy of this message | ||
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) And as always, before the PEAR standard in PHP_CodeSniffer could be changed, the written PEAR standard would need to be changed. Greg