Req #52505 [Opn->Wfx]: Define namespace relative to current (namespace) context
| From: | nikic@php.net | Date: | Sat, 11 Mar 2017 17:49:19 +0000 |
| Subject: | Req #52505 [Opn->Wfx]: Define namespace relative to current (namespace) context | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207785@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52505&edit=1
ID: 52505
Updated by: nikic@php.net
Reported by: robert dot de dot wilde at online dot nl
Summary: Define namespace relative to current (namespace)
context
-Status: Open
+Status: Wont fix
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:
Namespaces in PHP are compile-time resolved, which necessitates them being strictly per-file --
includes are run-time operations. This is not going to change, so I'm marking this as
Won't Fix.
Previous Comments:
------------------------------------------------------------------------
[2010-07-31 10:04:18] robert dot de dot wilde at online dot nl
content > context
------------------------------------------------------------------------
[2010-07-31 10:03:49] robert dot de dot wilde at online dot nl
Description:
------------
Sometimes it would be usefull to be able to define namespace relative to the current namespace
content, for example in case of includes/requires where the same .skel is used over and over. See
test script.
Test script:
---------------
// global file
namespace MyNS\Usr\Models
{
require_once('MadMans\class.MadMansModel.php');
print_r(
new MadMan\MadMansModel() /* which refers to MyNs\Usr\Models\MadMan\MadMansModel */
);
}
// required file
namespace .\MadMan
{
class MadMansModel
{ // ..
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=52505&edit=1