website/errors/assert.internalEnum.md
<?php declare(strict_types = 1);
namespace Vendor {
/** @internal */
enum Status: string {
case Active = 'active';
case Inactive = 'inactive';
}
}
namespace App {
class Validator {
/**
* @phpstan-assert \Vendor\Status $value
* @param mixed $value
*/
public function assertStatus($value): void
{
}
}
}
A @phpstan-assert PHPDoc tag references an enum that is marked as @internal. Internal types are not meant to be used outside of the package or namespace where they are defined. Depending on internal types in your assertions creates a fragile dependency on implementation details that can change without notice.
Use a public (non-internal) type in the @phpstan-assert tag instead. If you need to assert a specific type, check whether the library provides a public alternative, or define your own type that serves the same purpose.