Hi

Am 2026-03-31 01:36, schrieb Daniel Scherzer:
I'd also like to draw specific attention to the open question, which I am soliciting feedback on: how should `#[\Override]` work for enum cases? See
the RFC page for details.

We've been pretty clear so far the “enum cases are just constants”, e.g. in the RFC for `#[\Deprecated]` (https://wiki.php.net/rfc/deprecated_attribute):

Enum cases are internally implemented as class constants. Adding the #[\Deprecated] attribute to an enum case will behave as expected.

Given that:

    interface NamedX {
        public const string Name = 'foo';
    }

    enum Foo implements NamedX {
        case Name;
    }

is a thing already and fails with:

    Type of Foo::Name must be compatible with Named::Name of type string

as expected and

    interface NamedX {
        public const Name = 'foo';
    }

    enum Foo implements NamedX {
        case Name;
    }

without defining the constant's type just works by the enum case shadowing the interface’s constant it seems consequent to allow `#[\Override]` on enum cases, even if likely not particularly useful.

Best regards
Tim Düsterhus

Reply via email to