Req #51469 [Opn]: why not Inner Classes?

From: Date: Tue, 08 Sep 2015 00:24:16 +0000
Subject: Req #51469 [Opn]: why not Inner Classes?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195864@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=51469&edit=1 ID: 51469 Updated by: cmb@php.net Reported by: giorgio dot liscio at email dot it Summary: why not Inner Classes? Status: Open Type: Feature/Change Request Package: Class/Object related Operating System: irrelevant PHP Version: 5.3.2 Block user comment: N Private report: N New Comment: FWIW: PHP 7 supports anonymous classes: <http://www.php.net/manual/en/language.oop5.anonymous.php>. Previous Comments: ------------------------------------------------------------------------ [2014-08-27 12:57:30] rausch dot nico at gmail dot com Inner classes would be really great imho! ------------------------------------------------------------------------ [2010-04-14 10:55:23] giorgio dot liscio at email dot it they are not, actually ------------------------------------------------------------------------ [2010-04-14 03:10:51] david71rj at gmail dot com You can use namespaces from PHP 5.3, is basically this. See doc. ------------------------------------------------------------------------ [2010-04-03 07:55:22] giorgio dot liscio at email dot it Description: ------------ hi, some object oriented architectures requires inner classes i'm not good with english language so i write some examples: in a library like PDO, now we can do some like this: class Database { public function prepareSql($sql){ return new Sql($sql)} } class Sql { public function setValue($search, $replace){} public function executeQuery(){return new ExecutedQuery();} } class ExecutedQuery { function fetch() function numRows() // etc } this api allows the developer to instantiate an ExecutedQuery with no Sql parameters escaping (class Sql) so inner classes are useful to make visible classes in some trusted environment: class Database { public function prepareSql($sql){ return new Sql($sql)} class Sql { public function setValue($search, $replace){} public function executeQuery(){return new ExecutedQuery();} class ExecutedQuery { function fetch() function numRows() // etc } } } i've read a lot of rfc on php's wiki but no one talks about inner classes (useful like traits and others new work in progress features) what do you think about this? ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=51469&edit=1

« previous php.bugs (#195864) next »