Re: Re: [RFC] Access to aliases definition by reflection
| From: | Miloslav Hůla | Date: | Fri, 31 Oct 2014 10:27:11 +0000 |
| Subject: | Re: Re: [RFC] Access to aliases definition by reflection | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78504@lists.php.net to get a copy of this message | ||
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: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; } -- Milouse Library\Http;class C {}$rc = new ReflectionClass('c');var_dump($rc->getDefinedAliases()); /* array(1) { ["http"] => string(12) "Library\Http" } */How is ReflectionClass C related toLibrary\HTTPat all?