$this->getName(), 'groupDescription' => $this->description, ]; if (! is_null($this->authenticated)) { $data['authenticated'] = $this->authenticated; } return $data; } protected function getName(): string { if (is_string($this->name)) { return $this->name; } if (interface_exists('BackedEnum') && is_a($this->name, 'BackedEnum')) { return $this->name->value; } throw new \InvalidArgumentException( 'The name property of a group must be either a PHP Backed Enum or a string' ); } }