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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Tue Jan 19 21:01:24 2021 UTC