website/errors/instanceof.internalInterface.md
<?php declare(strict_types = 1);
namespace Vendor {
/** @internal */
interface InternalInterface {}
}
namespace App {
function checkHandler(object $obj): void
{
if ($obj instanceof \Vendor\InternalInterface) {
}
}
}
The interface used in the instanceof expression has been marked as @internal. Internal interfaces are not part of the public API of the package that defines them. Relying on internal types in instanceof checks creates a dependency on implementation details that may change without notice in future versions of the package.
Use a public interface or class provided by the package instead:
function checkHandler(object $obj): void
{
- if ($obj instanceof \Vendor\InternalInterface) {
+ if ($obj instanceof \Vendor\PublicInterface) {
}
}
If no public alternative exists, contact the package maintainer to request a public API.