0){ throw new \ArgumentCountError("Expected exactly 0 arguments, " . count($arguments) . " passed"); } return self::getAll()[mb_strtoupper($name)]; } /** * Returns a list of all cases, indexed by name. * * @return self[] * @phpstan-return array */ public static function getAll() : array{ /** @var array|null $result */ static $result = null; if($result === null){ $result = []; foreach(self::cases() as $case){ $result[mb_strtoupper($case->name)] = $case; } } return $result; } /** * Shim for {@link \UnitEnum::name}. * * @deprecated Use the native enum's name property instead. */ public function name() : string{ return $this->name; } /** * Alias of spl_object_id($this). * * @deprecated */ public function id() : int{ return spl_object_id($this); } /** * Returns whether the two objects are equivalent. * * @deprecated Native enums can be safely compared with ===. */ public function equals(self $other) : bool{ return $this === $other; } }