|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-07-31 09:58 UTC] 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 // <<
{}
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 20:00:01 2025 UTC |
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...Two cases: namespace Language\Programming\Scripting; { class Php extends ..\Scripting {} } VS namespace Language\Programming\Scripting; { class Php extends \Language\Programming\Scripting {} } This example, I suppose, covers a huge percentage of class extendings. And, as you can see, first variant is much more easier and convenient in using.