Support for friend classes

From: Date: Tue, 10 Jan 2006 22:37:05 +0000
Subject: Support for friend classes
Groups: php.internals 
Request: Send a blank email to internals+get-21469@lists.php.net to get a copy of this message
Hi. I'm responsible for writing unit tests for our PHP projects at work. I would find C++ style friend classes really useful for getting at another class's private methods. Since we adopted PHP5 we have been using lots of private methods to clean our interfaces up. Great news for everyone except me! I'd like to be able to do something like: class Coder { friend class CoderTest; private static function encode() { ... } } class CoderTest { $expected = ... $actual = Coder::encode(...); if( $expected != $actual ) ... } There is feature request on bugs.php.net (#34044) about this already, but no comments. Is there any support for this sort of thing out there? Useful addition to PHP6 maybe, or just another unnecessary feature? :-) Cheers, Leon

« previous php.internals (#21469) next »