Skip to content

Commit 6f7f189

Browse files
wishbornclaude
andcommitted
fix: resolve PHPStan errors from merged PRs
- MessageMap (prism-php#971): guard first() against null before accessing reasoning properties. - EnumSchema (prism-php#1024): add value types to options() docblock. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent de2aa70 commit 6f7f189

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/Providers/OpenAI/Maps/MessageMap.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ protected function mapAssistantMessage(AssistantMessage $message): void
122122
->groupBy(fn (ToolCall $toolCall): string => $toolCall->reasoningId ?? '');
123123

124124
foreach ($grouped as $reasoningId => $toolCalls) {
125-
if ($reasoningId !== '') {
126-
$first = $toolCalls->first();
125+
$first = $toolCalls->first();
126+
127+
if ($reasoningId !== '' && $first instanceof ToolCall) {
127128
$this->mappedMessages[] = [
128129
'type' => 'reasoning',
129130
'id' => $first->reasoningId,

src/Schema/EnumSchema.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public function toArray(): array
3434
];
3535
}
3636

37+
/**
38+
* @return array<int, string|int|float|null>
39+
*/
3740
protected function options(): array
3841
{
3942
$options = $this->options;

0 commit comments

Comments
 (0)