Description

Though function names may not contain the underscore character, class methods that are declared as protected or private must begin with a single underscore, as in the following example:

class Zend_Foo
{
protected function _fooBar()
{
// ...
}
}

Other members of this component, such as {{$testing}} and {{$testing_response}} also should be modified to comply with coding standards.

I should also recommend considering whether {{private}} is the appropriate designation for such class members. Though sometimes appropriate to use {{private}}, it is generally the case that making class members {{protected}} allows for an appropriate public API while providing for extensibility through class inheritance.

Comments

Posted by Simone Carletti (weppos) on 2008-01-08T03:15:53.000+0000

I contacted Chris, I'm going to take in charge this fix. :)

@ Darby

Considering that those methods/variables were declared as protected, I assume it's safe to change their scope/name for the next ZF release (1.5). There shouldn't be any BC issue.

Do you agree?

Posted by Darby Felton (darby) on 2008-01-08T08:19:51.000+0000

Well, I do not agree that there is no BC issue. Obviously people who have extended the class could be affected. However, because the likelihood of such extension for this component seems minimal, and because the BC impact deals only with naming (e.g., not behavioral changes to class logic), I do not see insurmountable problems arising with making the changes for 1.5. Thanks for looking at this, Simone! :)

Posted by Simone Carletti (weppos) on 2008-01-08T08:40:07.000+0000

Obviously people who have extended the class could be affected.

Perhaps I confused PHP behavior with Java... but as far I remember (in PHP) child classes haven't access to parent private methods but only to protected or public ones.
But may be I'm wrong, I'm going to run more tests.

I do not see insurmountable problems arising with making the changes for 1.5.

Great, I'm going to fix this ticket asap.

Posted by Darby Felton (darby) on 2008-01-08T08:47:01.000+0000

bq. Perhaps I confused PHP behavior with Java... but as far I remember (in PHP) child classes haven't access to parent private methods but only to protected or public ones. But may be I'm wrong, I'm going to run more tests.

Yes, of course, I meant that renaming protected methods could affect extending classes.