From:             
Operating system: irrelevant
PHP version:      5.3.2
Package:          Class/Object related
Bug Type:         Feature/Change Request
Bug description:why not Inner Classes?

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 bug report at http://bugs.php.net/bug.php?id=51469&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51469&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51469&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51469&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51469&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51469&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51469&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51469&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51469&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51469&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51469&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51469&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51469&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51469&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51469&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51469&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51469&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51469&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51469&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51469&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51469&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51469&r=mysqlcfg

Reply via email to