php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #52505 Define namespace relative to current (namespace) context
Submitted: 2010-07-31 10:03 UTC Modified: 2017-03-11 17:49 UTC
From: robert dot de dot wilde at online dot nl Assigned:
Status: Wont fix Package: Class/Object related
PHP Version: 5.3.3 OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: robert dot de dot wilde at online dot nl
New email:
PHP Version: OS:

 

 [2010-07-31 10:03 UTC] 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
   {   // ..
   }
}




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-31 10:04 UTC] robert dot de dot wilde at online dot nl
content > context
 [2010-12-01 15:32 UTC] jani@php.net
-Package: *Programming Data Structures +Package: Class/Object related
 [2017-03-11 17:49 UTC] nikic@php.net
-Status: Open +Status: Wont fix
 [2017-03-11 17:49 UTC] nikic@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 15:01:34 2025 UTC