Re: Getting rid of "underscore for private method names" codingstandard
| From: | Kouber Saparev | Date: | Fri, 15 Jan 2010 08:35:00 +0000 |
| Subject: | Re: Getting rid of "underscore for private method names" codingstandard | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-53209@lists.php.net to get a copy of this message | ||
Christian Weiske wrote:
Hello all, I refer to http://pear.php.net/manual/en/standards.naming.php Time has come to get rid of the "Private class members are preceded by a single underscore" rule. There are several reasons for that: 1. PHP5 has visibility modificator support (public, private, protected) 2. Having an underscore preceding private methods and class variables makes it impossible to open up the API without breaking existing code. Just imagine that a currently private method shall become protected or public because time has shown that it can and should be used outside. Technically it is no BC (backwards compatibility) break, because private methods and class variables could only be used from within the class itself, but still it may mean that a lot of code has to be changed. Ideas on this issue?I agree. As to the BC issues, we can already remove this requirement from CS and follow it for new packages only? And if for some reason an "old-style" (underscored) private method needs to be made public, then there's the possibility to just make a public wrapper around it: public function getName() {
return $this->_getName();} -- Kouber Saparev http://kouber.saparev.com