Skip to content

Update stubs for ext-mongodb 2.0 #1729

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
May 6, 2025
Merged

Conversation

alcaeus
Copy link
Contributor

@alcaeus alcaeus commented Apr 10, 2025

I opted for making the 2.0 version the only version we support. I'm not sure if we could use conditional class definitions to cover both 1.x and 2.x, I'd rather have people use this as motivation to move away from 1.x

@alcaeus alcaeus force-pushed the mongodb-ext-2.0 branch 2 times, most recently from 8304519 to 9bdc376 Compare April 10, 2025 11:44
@alcaeus
Copy link
Contributor Author

alcaeus commented Apr 10, 2025

@isfedorov CI seems to be having a bad day - it fails before even finishing setting up docker containers.

@isfedorov
Copy link
Contributor

@alcaeus Please try to rebase. I've removed problematic dependency

@alcaeus
Copy link
Contributor Author

alcaeus commented Apr 11, 2025

@isfedorov thank you, that looks "better". Now it's my fault for the red CI, will check that out and fix it in the coming days.

@alcaeus
Copy link
Contributor Author

alcaeus commented Apr 17, 2025

I'm not completely familiar with the test setup, but I can only assume that the failures are because we removed some constants in the 2.0 version of the extension, while reflection output still sees them there. This would indicate that the 1.x extension is somehow installed, but I can't find where, the only place that explicitly mentions the MongoDB extension is the tests/DockerImages/peclExtensions image, but installation is disabled there and can't be enabled as the image uses PHP 8.0 which is no longer supported by us.

@isfedorov can you point me in the right direction for fixing tests? Is there a way to mark constants, methods, or classes as removed in an extension release instead of completely removing them from the stubs?

@isfedorov
Copy link
Contributor

@alcaeus as far as I can see the issue is related to the fact that removed constant is used in .meta file meta/.phpstorm.meta.php . It uses this constant as an expected argument's value expectedArguments(\MongoDB\Driver\ReadPreference::__construct(), 0, \MongoDB\Driver\ReadPreference::RP_PRIMARY,\MongoDB\Driver\ReadPreference::RP_PRIMARY_PREFERRED,\MongoDB\Driver\ReadPreference::RP_SECONDARY,\MongoDB\Driver\ReadPreference::RP_SECONDARY_PREFERRED,\MongoDB\Driver\ReadPreference::RP_NEAREST); so you need to update this usage

@alcaeus alcaeus force-pushed the mongodb-ext-2.0 branch from 98e67cb to 612f94e Compare May 6, 2025 09:16
@alcaeus
Copy link
Contributor Author

alcaeus commented May 6, 2025

Thanks @isfedorov, I wasn't aware that file was used for stubs as well. I changed to the correct constants there and it fixed the tests. The cs-fixer task is failing due to errors in unrelated files (see logs), so I think this PR is ready to go.

@isfedorov
Copy link
Contributor

@alcaeus Yes, please ignore cs-fixer failure. PR is good to go. But I suppose this version of stubs will be bundled only into PhpStorm 2025.2, (in July) unfortunately.

@isfedorov isfedorov merged commit d2e376c into JetBrains:master May 6, 2025
11 of 12 checks passed
@alcaeus alcaeus deleted the mongodb-ext-2.0 branch May 6, 2025 09:35
@alcaeus
Copy link
Contributor Author

alcaeus commented May 6, 2025

But I suppose this version of stubs will be bundled only into PhpStorm 2025.2, (in July) unfortunately.

No worries. Out of curiosity, I was under the impression that the stubs are updated automatically from the repo - is that not the case?

@isfedorov
Copy link
Contributor

They are updated automatically from the repo but are being merged only to main branch. And due to internal policies and workflow with main/stable/release branches they will not be backported to the 2025.1 minor updates.

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