Open
Description
Symfony version(s) affected
7.3.1
Description
When a class contains only imported custom types then they are ignored by Symfony\Component\TypeInfo\TypeContext\TypeContextFactory::resolveTypeAliases()
because the parameter $toResolve
is empty, however the parameter $resolved
is not empty but completely ignored.
How to reproduce
This code fails:
/**
* @phpstan-import-type ImportedType from ImportedTypeClass
*/
class ImportedTypeUser
{
/** @var ImportedType */
private array $importedTypeVariable;
}
But this code works:
/**
* @phpstan-import-type ImportedType from ImportedTypeClass
* @phpstan-type LocalType int
*/
class ImportedTypeUser
{
/** @var ImportedType */
private array $importedTypeVariable;
/** @var LocalType */
private int $localTypeVariable;
}
Possible Solution
Do not ignore non-empty $resolved
in Symfony\Component\TypeInfo\TypeContext\TypeContextFactory::resolveTypeAliases()
.
Additional Context
No response