Closed
Description
Following the example below:
namespace App;
use Common\Domain\DayOfWeek;
class Foo
{
/**
* @var DayOfWeek
*/
private $dayOfWeek;
}
Unfortunately, instead of the typeCommon\Domain\DayOfWeek
on the dayOfWeek
property, its type is App\DayOfWeek
.
After a longer digging, I stumbled upon ContextFactory::extractUseStatements
method. The problem here is how this method uses aliasing.
For the example above the Context::getNamespaceAliases
call will end up with
array('Common\Domain\DayOfWeek' => 'Common\Domain\DayOfWeek')
instead of
array('DayOfWeek' => 'Common\Domain\DayOfWeek')
Also, I noticed the tests testReadsAliasesFromClassReflection
, testReadsAliasesFromProvidedNamespaceAndContent
are incorrect for ContextFactory
, that's why it looks like no one has been able to notice it all this time.
Metadata
Metadata
Assignees
Labels
No labels