Commit 9a2845f
committed
bug #1177 [AI Bundle] Fix PHPDoc type for collected platform call data (camilleislasse)
This PR was merged into the main branch.
Discussion
----------
[AI Bundle] Fix PHPDoc type for collected platform call data
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| Docs? | no
| Issues | -
| License | MIT
This PR fixes the PHPDoc type for `DataCollector::getPlatformCalls()`.
## Problem
The `PlatformCallData` type (defined in `TraceablePlatform`) declares `result: DeferredResult`. However, after `DataCollector::lateCollect()` processes the data through `awaitCallResults()`, the `result` field is transformed to `string|iterable|object|null` and a `metadata` field is added.
This causes PHPStan errors when testing code that accesses the transformed data (e.g., `assertNull($dataCollector->getPlatformCalls()[0]['result'])`).
## Solution
Introduce a new PHPDoc type `CollectedPlatformCallData` that accurately describes the data returned by `getPlatformCalls()` after transformation:
```php
`@phpstan`-type CollectedPlatformCallData array{
model: string,
input: array<mixed>|string|object,
options: array<string, mixed>,
result: string|iterable<mixed>|object|null,
metadata: Metadata,
}
```
Commits
-------
78243f1 Fix PHPDoc type for collected platform call data1 file changed
+10
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
| |||
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
91 | | - | |
| 99 | + | |
92 | 100 | | |
93 | 101 | | |
94 | 102 | | |
| |||
136 | 144 | | |
137 | 145 | | |
138 | 146 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 147 | + | |
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
| |||
0 commit comments