Re: [RFC] Specify namespace to include file into.
| From: | Ralph Schindler | Date: | Thu, 08 Mar 2012 16:30:09 +0000 |
| Subject: | Re: [RFC] Specify namespace to include file into. | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-58789@lists.php.net to get a copy of this message | ||
At first glance, this is technically impossible, with regards to our current resolution rules: http://php.net/manual/en/language.namespaces.rules.php
Assuming you have an un-namespaced:
class Db {
public function __construct() {
$this->conn = new PDO(..);} } and you require this as: require ./path/to/Db.php, 'Some\SubDb'; How does PDO get resolved? Automatically as \PDO or as \Some\SubDb\PDO? Isn't it just easier to change the code? ;) -ralph On 3/8/12 10:05 AM, Michael Morris wrote:
https://wiki.php.net/rfc/changes_to_include_and_require Since the reaction to the first of the two suggestions was largely negative I've withdrawn it for now to focus on the second of the two changes. In all honestly, these two suggestions should have had independent RFC's from the start. Of the two suggestions this one has the more profound implications to the language even if it is simpler to implement. Thoughts?