Skip to content

[AI Bundle] Fix PHPDoc type for collected platform call data#1177

Merged
OskarStark merged 1 commit intosymfony:mainfrom
camilleislasse:fix/profiler-platform-call-data-phpdoc
Dec 17, 2025
Merged

[AI Bundle] Fix PHPDoc type for collected platform call data#1177
OskarStark merged 1 commit intosymfony:mainfrom
camilleislasse:fix/profiler-platform-call-data-phpdoc

Conversation

@camilleislasse
Copy link
Copy Markdown
Contributor

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:

@phpstan-type CollectedPlatformCallData array{
    model: string,
    input: array<mixed>|string|object,
    options: array<string, mixed>,
    result: string|iterable<mixed>|object|null,
    metadata: Metadata,
}

@carsonbot carsonbot added Bug Something isn't working Status: Needs Review labels Dec 17, 2025
@carsonbot carsonbot changed the title [AiBundle] Fix PHPDoc type for collected platform call data [AI Bundle] Fix PHPDoc type for collected platform call data Dec 17, 2025
@carsonbot carsonbot changed the title [AI Bundle] Fix PHPDoc type for collected platform call data Fix PHPDoc type for collected platform call data Dec 17, 2025
@OskarStark OskarStark added the AI Bundle Issues & PRs about the AI integration bundle label Dec 17, 2025
@carsonbot carsonbot changed the title Fix PHPDoc type for collected platform call data [AI Bundle] Fix PHPDoc type for collected platform call data Dec 17, 2025
@OskarStark
Copy link
Copy Markdown
Contributor

Thank you Camille.

@OskarStark OskarStark merged commit 9a2845f into symfony:main Dec 17, 2025
397 of 398 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Bundle Issues & PRs about the AI integration bundle Bug Something isn't working Status: Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants