Req #50552 [Fbk->NoF]: Add function to get all used namespaces

From: Date: Sun, 05 Dec 2021 04:22:08 +0000
Subject: Req #50552 [Fbk->NoF]: Add function to get all used namespaces
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238187@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=50552&edit=1 ID: 50552 Updated by: php-bugs@lists.php.net Reported by: kristopherwilson at gmail dot com Summary: Add function to get all used namespaces -Status: Feedback +Status: No Feedback Type: Feature/Change Request Package: Scripting Engine problem Operating System: * PHP Version: * Assigned To: cmb Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2021-11-23 11:24:52] cmb@php.net 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> ------------------------------------------------------------------------ [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

« previous php.bugs (#238187) next »