website/errors/generics.internalInterfaceBound.md
<?php declare(strict_types = 1);
namespace Vendor {
/** @internal */
interface InternalInterface {}
}
namespace App {
/**
* @template T of \Vendor\InternalInterface
*/
class Container {}
}
A template type bound references an interface that is marked as @internal. The @template T of SomeInterface syntax constrains the template type to subtypes of the given interface. When that interface is internal, using it as a bound creates a dependency on an implementation detail that may change without notice.
Use a public interface as the template type bound instead:
/**
- * @template T of \Vendor\InternalInterface
+ * @template T of \Vendor\PublicInterface
*/
class Container {}
If no suitable public interface exists, consider removing the bound or contacting the library maintainers:
/**
- * @template T of \Vendor\InternalInterface
+ * @template T
*/
class Container {}