Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Responses/Moderations/CreateResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
* @param array<int, CreateResponseResult> $results
*/
private function __construct(
public readonly string $id,
public readonly string $model,
public readonly ?string $id,
public readonly ?string $model,
public readonly array $results,
private readonly MetaInformation $meta,
) {}
Expand All @@ -43,11 +43,11 @@
{
$results = array_map(fn (array $result): CreateResponseResult => CreateResponseResult::from(
$result
), $attributes['results']);
), $attributes['results'] ?? []);

Check failure on line 46 in src/Responses/Moderations/CreateResponse.php

View workflow job for this annotation

GitHub Actions / Formats P8.2 - ubuntu-latest - prefer-stable

Offset 'results' on array{id: string, model: string, results: array<int, array{categories: array<string, bool>, category_scores: array<string, float>, flagged: bool, category_applied_input_types?: array<string, array<int, string>>}>} on left side of ?? always exists and is not nullable.

Check failure on line 46 in src/Responses/Moderations/CreateResponse.php

View workflow job for this annotation

GitHub Actions / Formats P8.2 - ubuntu-latest - prefer-lowest

Offset 'results' on array{id: string, model: string, results: array<int, array{categories: array<string, bool>, category_scores: array<string, float>, flagged: bool, category_applied_input_types?: array<string, array<int, string>>}>} on left side of ?? always exists and is not nullable.

return new self(
$attributes['id'],
$attributes['model'],
$attributes['id'] ?? null,

Check failure on line 49 in src/Responses/Moderations/CreateResponse.php

View workflow job for this annotation

GitHub Actions / Formats P8.2 - ubuntu-latest - prefer-stable

Offset 'id' on array{id: string, model: string, results: array<int, array{categories: array<string, bool>, category_scores: array<string, float>, flagged: bool, category_applied_input_types?: array<string, array<int, string>>}>} on left side of ?? always exists and is not nullable.

Check failure on line 49 in src/Responses/Moderations/CreateResponse.php

View workflow job for this annotation

GitHub Actions / Formats P8.2 - ubuntu-latest - prefer-lowest

Offset 'id' on array{id: string, model: string, results: array<int, array{categories: array<string, bool>, category_scores: array<string, float>, flagged: bool, category_applied_input_types?: array<string, array<int, string>>}>} on left side of ?? always exists and is not nullable.
$attributes['model'] ?? null,

Check failure on line 50 in src/Responses/Moderations/CreateResponse.php

View workflow job for this annotation

GitHub Actions / Formats P8.2 - ubuntu-latest - prefer-stable

Offset 'model' on array{id: string, model: string, results: array<int, array{categories: array<string, bool>, category_scores: array<string, float>, flagged: bool, category_applied_input_types?: array<string, array<int, string>>}>} on left side of ?? always exists and is not nullable.

Check failure on line 50 in src/Responses/Moderations/CreateResponse.php

View workflow job for this annotation

GitHub Actions / Formats P8.2 - ubuntu-latest - prefer-lowest

Offset 'model' on array{id: string, model: string, results: array<int, array{categories: array<string, bool>, category_scores: array<string, float>, flagged: bool, category_applied_input_types?: array<string, array<int, string>>}>} on left side of ?? always exists and is not nullable.
$results,
$meta,
);
Expand All @@ -58,7 +58,7 @@
*/
public function toArray(): array
{
return [

Check failure on line 61 in src/Responses/Moderations/CreateResponse.php

View workflow job for this annotation

GitHub Actions / Formats P8.2 - ubuntu-latest - prefer-stable

Method OpenAI\Responses\Moderations\CreateResponse::toArray() should return array{id: string, model: string, results: array<int, array{categories: array<string, bool>, category_scores: array<string, float>, flagged: bool, category_applied_input_types?: array<string, array<int, string>>}>} but returns array{id: string|null, model: string|null, results: array<int, array{categories: array<string, bool>, category_scores: array<string, float>, flagged: bool, category_applied_input_types?: array<string, array<int, string>>}>}.

Check failure on line 61 in src/Responses/Moderations/CreateResponse.php

View workflow job for this annotation

GitHub Actions / Formats P8.2 - ubuntu-latest - prefer-lowest

Method OpenAI\Responses\Moderations\CreateResponse::toArray() should return array{id: string, model: string, results: array<int, array{categories: array<string, bool>, category_scores: array<string, float>, flagged: bool, category_applied_input_types?: array<string, array<int, string>>}>} but returns array{id: string|null, model: string|null, results: array<int, array{categories: array<string, bool>, category_scores: array<string, float>, flagged: bool, category_applied_input_types?: array<string, array<int, string>>}>}.
'id' => $this->id,
'model' => $this->model,
'results' => array_map(
Expand Down
Loading