Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Sep 15, 2024
1 parent 11bc3b2 commit 6e18c81
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions tests/Generator/Client/resource/php_content_type/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ public function form(array $body): array
}

/**
* @param mixed $body
* @return mixed
* @param \stdClass $body
* @return \stdClass
* @throws JsonException
* @throws ClientException
*/
public function json(mixed $body): mixed
public function json(\stdClass $body): \stdClass
{
$url = $this->parser->url('/json', [
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

class JsonException extends KnownStatusCodeException
{
private mixed $payload;
private \stdClass $payload;

public function __construct(mixed $payload)
public function __construct(\stdClass $payload)
{
parent::__construct('The server returned an error');

$this->payload = $payload;
}

/**
* @return mixed
* @return \stdClass
*/
public function getPayload(): mixed
public function getPayload(): \stdClass
{
return $this->payload;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ export class Client extends ClientAbstract {
}

/**
* @returns {Promise<Record<string, string>>}
* @returns {Promise<URLSearchParams>}
* @throws {FormException}
* @throws {ClientException}
*/
public async form(body: Record<string, string>): Promise<Record<string, string>> {
public async form(body: URLSearchParams): Promise<URLSearchParams> {
const url = this.parser.url('/form', {
});

Expand All @@ -81,7 +81,7 @@ export class Client extends ClientAbstract {
};

try {
const response = await this.httpClient.request<Record<string, string>>(params);
const response = await this.httpClient.request<URLSearchParams>(params);
return response.data;
} catch (error) {
if (error instanceof ClientException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {KnownStatusCodeException} from "sdkgen-client"

export class FormException extends KnownStatusCodeException {

public constructor(private payload: Record<string, string>) {
public constructor(private payload: URLSearchParams) {
super('The server returned an error');
}

public getPayload(): Record<string, string> {
public getPayload(): URLSearchParams {
return this.payload;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ public function binary(#[Body] \Psr\Http\Message\StreamInterface $body): \Psr\Ht
#[Post]
#[Path('/form')]
#[StatusCode(200)]
public function form(#[Body] array $body): array
public function form(#[Body] \stdClass $body): \stdClass
{
// @TODO implement method
}

#[Post]
#[Path('/json')]
#[StatusCode(200)]
public function json(#[Body] mixed $body): mixed
public function json(#[Body] \stdClass $body): \stdClass
{
// @TODO implement method
}

#[Post]
#[Path('/multipart')]
#[StatusCode(200)]
public function multipart(#[Body] array $body): array
public function multipart(#[Body] \PSX\Data\Reader\Multipart $body): \PSX\Data\Reader\Multipart
{
// @TODO implement method
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class AppController {

@Post('/form')
@HttpCode(200)
form(@Body() body: Record<string, string>): Record<string, string> {
form(@Body() body: URLSearchParams): URLSearchParams {
// @TODO implement method
return {};
}
Expand Down

0 comments on commit 6e18c81

Please sign in to comment.