Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Fix accepted stage type in FluentFactoryTrait #71

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Mar 22, 2024

Fix mongodb/laravel-mongodb#2738 (comment)

Get the stage type accepted by Pipeline.

* @psalm-type stage = StageInterface|array<string,mixed>|stdClass

@GromNaN GromNaN requested a review from jmikola March 22, 2024 20:09

$trait->addProperty('pipeline')
->setType('array')
->setComment('@var list<StageInterface>')
->setComment('@var list<StageInterface|array<string,mixed>|stdClass>')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was stdClass added? In https://github.com/mongodb/laravel-mongodb/pull/2738/files#r1536149792, you only needed array<string,mixed>.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that's what is accepted by the Pipeline class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An existing Pipeline object is also accepted by the Pipeline constructor (for appending IIRC). I just assumed this would be as restrictive as possible based on what the trait enables users to do.

Defer to you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property is public. The user can append anything to the array.

@GromNaN GromNaN merged commit 6bc447f into mongodb:0.2 Mar 25, 2024
@GromNaN GromNaN deleted the fluent-stages-type branch March 25, 2024 15:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants