Dne 30.10.2014 14:50, Levi Morrison napsal(a):
I also don't think this feature is needed. In comments, simply use
fully qualified names.
FQN can be used in docblocks, that's true. But if you write some library
which uses annotations and you want to offer a kind of comfort to your
users, your hands are tied. You force them to use FQN.
Personaly, I don't like any code/information duplication. Using FQN when
the alias is already defined is wrong.
And generally, there is no way how to get defined aliases in current PHP.
Additionally, I really don't see how these are related to each other:
use Library\Http;
class C {}
$rc = new ReflectionClass('c');
var_dump($rc->getDefinedAliases());
/*
array(1) {
["http"] => string(12) "Library\Http"
}
*/
How is ReflectionClass C related to `Library\HTTP` at all?
This example from RFC shows scope of defined aliases only.
On the beginning, I was thinking where to place the "access point" to
aliases definition. When I realized, that alias can be defined anywhere
except a class or function body, ReflectionClass and ReflectionFunction
looks like right place.
The relation is more obvious in following example:
use Library\Http;
class C
{
/** @var Http\Clients\CurlClient */
public $client;
}
-- Milo
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php