website/errors/requireImplements.deprecatedEnum.md
<?php declare(strict_types = 1);
/** @deprecated Use NewInterface instead */
enum Suit: string
{
case Hearts = 'hearts';
case Diamonds = 'diamonds';
}
/**
* @phpstan-require-implements Suit
*/
trait SuitTrait {}
The @phpstan-require-implements PHPDoc tag references an enum that has been marked as @deprecated. Using deprecated symbols in new code perpetuates reliance on APIs that are scheduled for removal or replacement. Since @phpstan-require-implements defines a contract for future use, referencing a deprecated enum in it is especially problematic.
Replace the deprecated enum with its non-deprecated replacement:
<?php declare(strict_types = 1);
/**
- * @phpstan-require-implements Suit
+ * @phpstan-require-implements NewSuitInterface
*/
trait SuitTrait {}
Note that @phpstan-require-implements can only reference interfaces, not enums. If the enum itself is the intended target, the PHPDoc tag should be changed to reference an interface that the enum implements.
This error is reported by the phpstan-deprecation-rules extension.