Skip to content

Reflection error on class_alias object definition after upgraded from 0.12.4 to 0.12.9 #2958

@shulard

Description

@shulard

Support question

Hello,

I'm using the hoa/websocket package which rely to class_alias to simplify some class names...

For example the class Hoa\Socket\Connection\Connection is aliased to Hoa\Socket\Connection.

You can check the definition here: https://github.com/hoaproject/Socket/blob/master/Source/Connection/Connection.php#L813

After updating to phpstan 0.12.9, I got an error :

Reflection error: Hoa\Socket\Connection not found.

Before the update, the analysis hasn't any trouble with the @param and @var aliased class names.

I saw that there is a new typeAliases in the configuration but it doesn't seems to fix my issue. Here is my local phpstan.neon configuration :

includes:
	- vendor/jangregor/phpstan-prophecy/src/extension.neon
parameters:
    level: max
    inferPrivatePropertyTypeFromConstructor: true
    paths:
        - public
        - src
        - tests
    typeAliases:
        Hoa\Socket\Connection: 'Hoa\Socket\Connection\Connection'
        Hoa\Stream: 'Hoa\Stream\Stream'

Do you know how to understand this issue and fix it ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions