Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type hint: createDocument(array $result) #1870

Closed
wants to merge 2 commits into from

Conversation

olvlvl
Copy link
Contributor

@olvlvl olvlvl commented Sep 29, 2018

Q A
Type bug/improvement
BC Break no
Related issues #1869

Summary

I found out the hard way that the implementation only works if the MongoDB client is configured to convert root and document types to array. Therefore, I believe the type hint of the $result parameter of the createDocument() method should be ?array instead of object.

I also added a commit that moves the type check to the caller method as to avoid an necessary method call. This change also allows narrowing the type hint of the $result parameter to array.

@olvlvl olvlvl changed the title Olvlvl type hint Fix type hint: createDocument(array $result) Sep 29, 2018
@alcaeus
Copy link
Member

alcaeus commented Oct 1, 2018

Cherry-picked into #1871. Thanks.

@alcaeus alcaeus closed this Oct 1, 2018
@olvlvl olvlvl deleted the olvlvl-type-hint branch October 1, 2018 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants