Skip to content

Commit 9dffe5f

Browse files
refactor: allow HelloResponseInterface methods to return framework-specific response objects
- Changed json() and render() return types from string to mixed - Updated docblocks to reflect flexible return type - Enables implementations to return framework-native response objects (e.g. Drupal JsonResponse, HtmlResponse, TrustedRedirectResponse)
1 parent 642575c commit 9dffe5f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/HelloResponse/HelloResponseInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ public function redirect(string $url);
8383
* for encoding and returning JSON data.
8484
*
8585
* @param array<string, mixed> $data The data to be converted to a JSON response.
86-
* @return string The string encoded JSON response data.
86+
* @return mixed
8787
*/
88-
public function json(array $data): string;
88+
public function json(array $data);
8989

9090
/**
9191
* Renders the given content as an HTTP response.
@@ -95,7 +95,7 @@ public function json(array $data): string;
9595
* depending on the framework or environment being used.
9696
*
9797
* @param string $content The content to render as a response.
98-
* @return string The rendered response content.
98+
* @return mixed
9999
*/
100-
public function render(string $content): string;
100+
public function render(string $content);
101101
}

0 commit comments

Comments
 (0)