typhoon
typhoon copied to clipboard
Type resolution edge case
interface A {}
interface B {}
final class AB implements A, B {}
interface GetA
{
/**
* @return A
*/
public function get(): mixed;
}
interface GetB
{
/**
* @return B
*/
public function get(): mixed;
}
final class Impl implements GetA, GetB
{
public function get(): mixed
{
return new AB();
}
}
$implReflection = TyphoonReflector::build()->reflectClass(Impl::class);
var_dump(TypeStringifier::stringify(
$implReflection
->getMethod('get')
->getTyphoonReturnType(),
));
Actual output:
/home/klimenko/IdeaProjects/typhoon-reflection/main.php:41:
string(1) "A"
Expected output:
/home/klimenko/IdeaProjects/typhoon-reflection/main.php:41:
string(1) "A&B"