Req #50552 [Opn->Fbk]: Add function to get all used namespaces
Edit report at https://bugs.php.net/bug.php?id=50552&edit=1
ID: 50552
Updated by: cmb@php.net
Reported by: kristopherwilson at gmail dot com
Summary: Add function to get all used namespaces
-Status: Open
+Status: Feedback
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: *
PHP Version: *
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Namespace imports are a compile time concept only; during runtime
PHP has no general notion of these, only of the fully qualified
names of individual classes, functions, etc. As such,
implementing this feature would require quite some changes,
possibly having detrimental effects on the engine, and the details
are sufficiently unclear, so this would require the RFC
process[1].
However, I wonder what would be the use-case at all. How could
that be useful "to aid in autoloading"?
[1] <https://wiki.php.net/rfc/howto>
Previous Comments:
------------------------------------------------------------------------
[2009-12-22 02:53:00] kristopherwilson at gmail dot com
Description:
------------
Provide a function for returning all namespaces used in the current request to aid in autoloading.
Reproduce code:
---------------
<?php
use My\Namespace;
use Other\Namespace;
print_r(get_used_namespaces());
?>
Expected result:
----------------
Array(
[0] = My\Namespace,
[1] = Other\Namespace
)
Actual result:
--------------
No such function exists.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=50552&edit=1
Thread (3 messages)