-
Hi all, I have run into an interesting psalm error. I get the following error:
I run on cycle/orm version 2.9.2 The reason that is interesting is in need of more context, so here is the relevant classes and interfaces, stripped of their implementation to bring into view the issue I am having. use Cycle\ORM\RepositoryInterface;
use Cycle\Annotated\Annotation\Entity;
/**
* @template TEntity
* @extends RepositoryInterface<TEntity>
*/
interface ExtendedRepositoryInterface extends RepositoryInterface
{
//... methods here.
}
/**
* @template TEntity
* @implements ExtendedRepositoryInterface<TEntity>
*/
abstract class AbstractRepository implements ExtendedRepositoryInterface
{
//... methods here.
}
/**
* @extends ExtendedRepositoryInterface<FailedQueueJobInterface>
*/
interface FailedQueueJobRepositoryInterface extends ExtendedRepositoryInterface
{
//... methods here.
}
interface FailedQueueJobInterface
{
//... methods here.
}
#[Entity(
repository: FailedQueueJobRepository::class,
table: 'v4_failed_queue_jobs',
)]
class FailedQueueJob implements FailedQueueJobInterface
{
//... methods here.
}
/**
* @extends AbstractRepository<FailedQueueJob>
*/
final class FailedQueueJobRepository extends AbstractRepository implements FailedQueueJobRepositoryInterface
{
//... methods here.
} I have found 3 solutions to my problem:
So my question(s) are: Is there another solution that I am missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Let's try the option 3. |
Beta Was this translation helpful? Give feedback.
Let's try the option 3.
For me,
of object
means "an instance of any class (not an int or string)." This is not@template-covariant
, and you can narrowobject
down to any specific class. However, this breaks in the case of a parameter where you can only extend the type.