$otherProperties */ public function __construct( private ?BooleanCapability $threePidChanges = null, private ?BooleanCapability $changePassword = null, private ?BooleanCapability $getLoginToken = null, private ?ProfileFieldsCapability $profileFields = null, private ?RoomVersionsCapability $roomVersions = null, private ?BooleanCapability $setAvatarUrl = null, private ?BooleanCapability $setDisplayname = null, private ?array $otherProperties = null, ) {} public function jsonSerialize(): array { $data = [ "m.3pid_changes" => $this->threePidChanges, "m.change_password" => $this->changePassword, "m.get_login_token" => $this->getLoginToken, "m.profile_fields" => $this->profileFields, "m.room_versions" => $this->roomVersions, "m.set_avatar_url" => $this->setAvatarUrl, "m.set_displayname" => $this->setDisplayname, ]; if (! empty($this->otherProperties)) { $data += $this->otherProperties; } return array_filter($data, fn ($value) => ! is_null($value)); } }