Closed as not planned
Description
Hey,
Nowadays there is a limit when trying to resolve a type from a phpDoc in PHP, you'll need to get a "context" for the file where the type as been written. Let's make an exemple with a use
import combined with the as
keyword:
use App\Command\Foo as Command;
/** @var Command */
$command = my_command();
Another example, you have two classes with the same name but in different namespaces: App\Foo
and App\Command\Foo
use App\Command\Foo;
/** @var Foo */
$command = my_command();
Considering both theses example, we require to parse the whole file to check for use
import statements so we can have context for the phpDoc types within this file.
To solve this issue with Reflection, it would require:
ReflectionFile
an object that describe the content of a file: a list ofReflectionImport
and any other stuff within that file (ReflectionClass
...)ReflectionImport
an object that describe a use statement with a linkedReflectionClass
and a local alias when required
I chosed to not use the keyword use
within Reflection here because I think it's too much missleading and import
has more meaning in that context.