Skip to content

Question: type-safe proxies #8603

@signor-pedro

Description

@signor-pedro

Hi, I am using psalm heavily and have reached a situation where I can have

public function doSth(EntityInterface|Proxy $entity): bool
{
    //....
}

All my entities implement the EntityInterface, because I enforce that every entity has a getId() method.

Obviously, my psalm now cries

Method Doctrine\Common\Proxy\Proxy::getId does not exist

Is there some adviced way to make Proxies type-safe? Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions