public function __construct(string $type) { if (!in_array($type, $this->allowed, true)) { throw InvalidTypeException::invalidType($type, $this->allowed); } $this->type = $type; }