-
Notifications
You must be signed in to change notification settings - Fork 696
Closed
Labels
Description
In the example below this works:
/**
* @template TInnerPackage of InnerPackage
* @template TGenericPackage of GenericPackage<TInnerPackage>
* @param class-string<TGenericPackage> $class FQCN to be instantiated
* @return TInnerPackage
*/
function loadWithDirectUnwrap(string $class) {
$package = new $class();
return $package->unwrap();
}but the indirect unwrapping fails to produce the templated inner class
/**
* @template TInnerPackage of InnerPackage
* @template TGenericPackage of GenericPackage<TInnerPackage>
* @param class-string<TGenericPackage> $class FQCN to be instantiated
* @return TInnerPackage
*/
function loadWithIndirectUnwrap(string $class) {
$package = new $class();
return unwrapGeneric($package);
}Reactions are currently unavailable