Enumerations may also have static methods. The use for static methods on the enumeration itself is primarily for alternative constructors. E.g.:
<?php enum Size { case Small; case Medium; case Large; public static function fromLength(int $cm): self { return match (true) { $cm < 50 => self::Small, $cm < 100 => self::Medium, default => self::Large, }; } } var_dump(Size::fromLength(50));
Static methods may be public, private, or protected, although in practice private and protected are equivalent as inheritance is not allowed.