Edit report at http://bugs.php.net/bug.php?id=52297&edit=1

 ID:               52297
 Comment by:       giorgio dot liscio at email dot it
 Reported by:      giorgio dot liscio at email dot it
 Summary:          visibility identifier namespace-protected
 Status:           Wont fix
 Type:             Feature/Change Request
 Package:          Class/Object related
 Operating System: all
 PHP Version:      5.3.2

 New Comment:

hi aharvey

i really want to contribute but my English is not good

i hope someone want to write an rfc



for anyone reads: feel free to write comments about this


Previous Comments:
------------------------------------------------------------------------
[2010-07-16 07:09:44] ahar...@php.net

PHP namespaces really aren't meant to be anything more than a way of

avoiding name collisions and allowing aliasing -- visibility modifiers

are somewhat beyond the scope of what they're trying to achieve.



If you really want to push this, I'd suggest raising this on the

Internals mailing list (preferably with a prototype patch) with a view

to putting this through the RFC process instead, given it would be a

moderately significant language change.

------------------------------------------------------------------------
[2010-07-09 02:56:36] giorgio dot liscio at email dot it

Description:
------------
hi, in php is missing a visibility identifier to protect methods and
properties inside the namespace



example:



namespace Oracle;  // abstraction layer for Oracle



class Connection

{

    // ociresource should be visible only in the namespace

    // in php 5.3 the property is public to world

    namespace-protected $ociresource;



    public function __construct()

    {

         $this->ociresource = oci_connect();

    }

    public function query($sql)

    {

         return new Query($this, $sql);

    }

}



class Query

{

    public function __construct(Connection $con, $sql)

    {

         $x = oci_parse($con->ociresource, $sql);    // $ociresource is
accessible only in this namespace

         oci_execute($x);

    }

}



----



suggested visibility identifier:



namespace-private

    (if namespace is \Test\Abc\ the method/property is only accessible
within \Test\Abc\)

namespace-protected

    (if namespace is \Test\Abc\ the method/property can be accessible
within \Test\Abc\ and, for example \Test\Abc\Foo\ )



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52297&edit=1

Reply via email to