<?php
/**
* @param T1 is \Baz\SomeClass Invariant generic type
* @param T2 is \Baz\Quz Invariant generic type
*/
class Bar{
/**
* @param T1 $foo
* @return T2
*/
function baz($foo){}
}
/**
* @param T1 isin \Bar\Foo Contravariant generic type - can only be used as parameter type of interface methods
* @param T2 isout \Foo Covariant generic type - can only be used as return type of interface methods
*/
interface Asd{
/**
* @param T1 $baz
* @return T2
*/
function test($baz);
}
/**
* @param AAAA \SomeClass\FooBar
* @extends Bar<Foo, AAAA>, Asd<Foo, Bar> Note that @extends covers both extended classes and implemented interfaces
*/
class Whatever{ ....... }
/** @var Whatever<AAAAChild> $foo */
$foo = new Whatever();
Would have something along the lines of: