$this->success, ]; if ($this->finisher !== null) { $data['finisher'] = $this->finisher->jsonSerialize(); } if (!empty($this->errors)) { $data['errors'] = $this->errors; } return $data; } public static function createSuccessResult( Finisher $finisher ): self { return new self( success: true, finisher: $finisher ); } /** * @param string[] $errors */ public static function createErrorResult(array $errors): self { return new self( success: false, errors: $errors ); } }