Edit report at https://bugs.php.net/bug.php?id=52504&edit=1
ID: 52504 Comment by: tom at tomwardrop dot com Reported by: robert dot de dot wilde at online dot nl Summary: Support relative namespaces Status: Open Type: Feature/Change Request Package: Class/Object related Operating System: Any PHP Version: 5.3.3 Block user comment: N Private report: N New Comment: I was just about to post the exact same feature suggestion. I'm using PHP 5.4 RC8 after 2 years of programming Ruby (I have a project that better lends itself to PHP template-orientated nature), and this was one of the first things I tried to do, reference a resource one level up in the namespace hierarchy. Luckily, my namespace isn't too deep, but I can imagine some of the larger frameworks which have 3-6+ level deep namespaces could really benefit from this. I'm surprised none of the dev's have commented on this. Previous Comments: ------------------------------------------------------------------------ [2010-08-18 15:44:12] robert dot de dot wilde at online dot nl Any developer can have a look? ------------------------------------------------------------------------ [2010-07-31 10:54:14] giorgio dot liscio at email dot it very nice, i really like it it would be nice too having * on import works only if __autoload or spl_autoload_register is used, otherwise triggers an error use MyNS\Test\*; // imports all classes in the "Test" namespace use MyNS\Test\**; // imports all the namespace hierarchy (including subpackages) from namespace Test __autoload($className, $importAll = FALSE, $importDeep = FALSE) { // handle * as a full dir import // ** imports subdirs too } in my framework i need to put use \FW\String; use \FW\Int; use \FW\Float; use \FW\Vector; use \FW\Dictionary; use \FW\Types; etc in every file... ------------------------------------------------------------------------ [2010-07-31 09:58:03] robert dot de dot wilde at online dot nl Description: ------------ It would be nice to have relative namespace support to keep code clean and flexible. When inside of a namespace, it would be nice to have some directory-path-like option like '..'. Test script: --------------- namespace MyNs\Some\Path\Going\A\Long\Way { class GoClass extends ..\..\Short\Way\GoClass // << {} } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=52504&edit=1