Skip to content

Commit 404699a

Browse files
committed
refactor: improves Message::toJson types
1 parent cf5b304 commit 404699a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Messages/DTO/Message.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ public function jsonSerialize(): array
122122
* {@inheritDoc}
123123
*
124124
* @since n.e.x.t
125+
*
126+
* @return self|UserMessage|ModelMessage|SystemMessage
125127
*/
126128
final public static function fromJson(array $json): Message
127129
{
@@ -133,17 +135,13 @@ final public static function fromJson(array $json): Message
133135

134136
// Determine which concrete class to instantiate based on role
135137
if ($role->isUser()) {
136-
/** @phpstan-ignore-next-line */
137138
return new UserMessage($parts);
138139
} elseif ($role->isModel()) {
139-
/** @phpstan-ignore-next-line */
140140
return new ModelMessage($parts);
141141
} elseif ($role->isSystem()) {
142-
/** @phpstan-ignore-next-line */
143142
return new SystemMessage($parts);
144143
}
145144

146-
/** @phpstan-ignore-next-line */
147145
return new self($role, $parts);
148146
}
149147
}

0 commit comments

Comments
 (0)