Open AndrolGenhald opened 2 years ago
@implements BackedEnum<Type>
is probably easier to implement.
I would think @extends
probably? Aren't backed enums implemented as classes extending BackedEnum
with a bunch of additional constraints? Looking at this again though you're right that a new annotation for that shouldn't be necessary.
Both BackedEnum
and UnitEnum
are interfaces, so it would be @implements
I want to be able to take a
BackedEnum<string> $enum
so that$enum->value
is definitely astring
. Currently I have false positives becauseBackedEnum::$value
isint|string
.BackedEnum
interface@enum<int>
maybe?)string
orint
, but you can't use@enum<positive-int>
withenum Foo: string
)case Bar = 0
should show an issue for@enum<positive-int>
)BackedEnum
template needs to be filled in from the@enum<[type]>
annotation so thatBackedEnum::from
,::tryFrom
, and::cases
use the correct type