Skip to content

[PropertyInfo] PhpStanExtractor does not support phpstan.neon-defined aliases #61302

@Seldaek

Description

@Seldaek

Symfony version(s) affected

7.3.2

Description

We define type aliases in phpstan's config file like this:

parameters:
    typeAliases:
        \Type\Language: 'value-of<\App\Locale\Languages::LOCALES>'

Then these can be used in the classes as you can see below, but PropertyInfo does not understand this and complains about \Type\Language not existing. If somehow possible to configure additional aliases to be loaded (phpstan can import php files too so we could make this a reusable type-aliases.php file that both phpstan and symfony load) or a path to the phpstan config file that would be great.

/**
 * @phpstan-type UserAttributes array{
 *     language?: \Type\Language
 * }
 */

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions