Skip to content

PHPLIB-1174: Rely on Binary constructor default type #1121

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

Merged
merged 2 commits into from
Jun 30, 2023

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Jun 30, 2023

@jmikola jmikola requested a review from GromNaN June 30, 2023 00:42
@@ -283,7 +283,7 @@ private function insertChunkFromBuffer(): void
$chunk = [
'files_id' => $this->file['_id'],
'n' => $this->chunkOffset,
'data' => new Binary($data, Binary::TYPE_GENERIC),
'data' => new Binary($data),
Copy link
Member

@GromNaN GromNaN Jun 30, 2023

Choose a reason for hiding this comment

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

The psalm error may be due to outdated stubs.

Strangely, it only alerts on this line, whereas it should be the same everywhere you've modified the call to new Binary.

I propose that you update the baseline until JetBrains/phpstorm-stubs#1553.

Copy link
Member Author

Choose a reason for hiding this comment

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

Aye, forgot to run CS tools locally. I'll get this fixed up.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just noticed that the Binary stub was never updated for PHPC-2101. I opened PHPORM-40 to track that, as there might have been other things missed in v1.15.

https://jira.mongodb.org/browse/PHPORM-40

Copy link
Member Author

Choose a reason for hiding this comment

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

@GromNaN: What does PhpStorm have to do with Psalm?

The Psalm stub for ext-mongodb only defines a few things with generics. I don't see anything in Psalm's composer.json that pulls in PhpStorm stubs.

I was under the impression that Psalm inferred extension APIs via Reflection, which should be correct.

Copy link
Member

Choose a reason for hiding this comment

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

Exact. Sorry for the confusion.

Suppress the TooFewArguments error since Psalm is not aware of the Binary constructor's default type.
@jmikola
Copy link
Member Author

jmikola commented Jun 30, 2023

Docs build failure is unrelated. I'm tracking that in PHPLIB-1175.

@jmikola jmikola merged commit b8af536 into mongodb:master Jun 30, 2023
@jmikola jmikola deleted the phplib-1174 branch June 30, 2023 15:50
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.

2 participants