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?



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to