website/errors/enum.implementsInternalTrait.md
<?php declare(strict_types = 1);
// In package vendor/some-package:
namespace SomePackage;
/** @internal */
trait InternalHelper {}
<?php declare(strict_types = 1);
// In your code:
use SomePackage\InternalHelper;
enum MyEnum implements InternalHelper
{
case Foo;
}
The enum references an internal trait in its implements clause. The trait is marked with @internal, meaning it is not meant to be used outside the package that defines it. Internal types can change or be removed without notice in future versions.
Additionally, using a trait in an implements clause is invalid PHP. Traits should be used with the use keyword inside the enum body, not in the implements clause.
If an interface is intended, use the correct non-internal interface:
-enum MyEnum implements InternalHelper
+enum MyEnum implements PublicInterface
{
case Foo;
}
If a trait is intended, move it to a use statement inside the enum body and ensure the trait is not internal:
-enum MyEnum implements InternalHelper
+enum MyEnum
{
+ use SomePublicTrait;
+
case Foo;
}