Use generic annotations
core23 opened this issue ยท 8 comments
Feature Request
We could add @template
annotations to our interfaces to provide more specific metadata.
Here's an example from doctrine: https://github.com/doctrine/collections/blob/master/lib/Doctrine/Common/Collections/Collection.php#L29-L32
The following classes could benefit from this:
- Model/ManagerInterface.php
- Adapter/AdapterInterface.php
Generics are now supported by PHPstan ๐
@greg0ire @franmomu @OskarStark Do you have any experience with this?
Generics are not supported by PHPstan ๐
not supported? or now supported?
I don't have experience with this but I'm all for helping SA tools/IDEs do their job as well as they can.
Typo ๐ they are NOW supported
I haven't tried either, but I think it would be great to start using them.
No experience but ๐ค๐ป๐๐ป
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
This is already done for Model/ManagerInterface.php
.
Do we really want this for Adapter/AdapterInterface.php
?
There is a check
$manager = $this->registry->getManagerForClass(\get_class($model));
if (!$manager instanceof EntityManagerInterface) {
return null;
}
Also we'll end having to make the AdapterChain generic which doesn't seems great to me.
I'll close this like this we can still add the generic the day we'll need it