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

From: Date: Wed, 27 Aug 2014 12:57:31 +0000
Subject: Req #51469 [Com]: why not Inner Classes?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187294@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 Comment by: rausch dot nico at gmail dot com 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: Inner classes would be really great imho! Previous Comments: ------------------------------------------------------------------------ [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 (#187294) next »