PHP/native/UnitEnum: Difference between revisions

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
No edit summary
No edit summary
Line 12: Line 12:
}
}
</syntaxhighlight>
</syntaxhighlight>
The member-variable is labelled "pseudocode" because a normal interface can't declare member-variables.

Revision as of 12:55, 25 August 2024

UnitEnum pseudointerface
manual page: The UnitEnum interface

{{#set: page title=UnitEnum pseudointerface }}

Note that this interface cannot actually be implemented as a standard class; it can only be (pseudo)implemented by declaring an enum.

If an enum is "backed" (declared as having a scalar value for each choice), it will implement this interface but also the [[../BackedEnum|BackedEnum]] interface.)

Definition

interface UnitEnum {
  static function cases(): array

  string $name; // pseudocode
}

The member-variable is labelled "pseudocode" because a normal interface can't declare member-variables.