Question: type-safe proxies #6685

Open
opened 2026-01-22 15:36:59 +01:00 by admin · 0 comments
Owner

Originally created by @signor-pedro on GitHub (Apr 8, 2021).

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

Originally created by @signor-pedro on GitHub (Apr 8, 2021). 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
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6685