Hi.

With pecl/http (DEV-2 branch) and the Functional extension (on github)
both creating namespaces within the extension, I think there is a
requirement for a mechanism to allow an extension to record the
namespace(s) that it has, in a similar fashion to how functions and
classes are known to core.

On the surface, the namespace seems to be consumed by the class name
or function name.

ReflectionClass and ReflectionFunciton both have a getNamespaceName()
method, but there is no corresponding method for ReflectionExtension,
which would need to getNamespaceNames() as an extension could
potentially register multiple namespaces - maybe nested ones.

In both of these methods, the namespace is simply extracted from the
current entity name, but without a way of recording the namespace(s)
provided by an extension.

I think the following should exist

array get_declared_namespaces ( [ bool $categorize = false ] ) Returns
the namespaces currently defined. If categorized, the namespaces are
categorised by the extension that loads them or with a key of 'user'
for user defined namespaces.

and

array ReflectionExtension::getNamespaces() Returns the namespaces for
the extension being reflected.


And I think that phpinfo() should output a "Registered Namespaces"
right at the top of the page, alongside the Registered Streams.


But, trawling all the classes and functions, extracting and
aggregating the namespace would really not seem to be the way to go.
And that wouldn't take into account the user defined namespaces.


So, (unless I'm mistaken and missing something), an extension needs to
record its namespaces somewhere along with userland namespaces.

Initially, I thought that putting a pointer to a list in
zend_module_entry would be enough to allow the php core code to pick
it up from the extension, but that would need to be at a suitable
version change rather than mid-cycle.

But really, this is out of my depth now.


Maybe a mentor/mentee would be useful here.


Regards,

Richard.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to