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

Always require PHP version for PhpStormStubsSourceStubber - PHP_VERSION_ID as default #874

Merged
merged 2 commits into from
Nov 23, 2021

Conversation

kukulich
Copy link
Collaborator

It's necessary for stubs like: https://github.com/JetBrains/phpstorm-stubs/blob/master/bcmath/bcmath.php#L198-L201

We have to know the version to choose the right parameter.

@kukulich kukulich changed the title Always require version for PhpStormStubsSourceStubber - PHP_VERSION_ID as default Always require PHP version for PhpStormStubsSourceStubber - PHP_VERSION_ID as default Nov 23, 2021
@@ -33,6 +33,8 @@
use function str_replace;
use function strtolower;

use const PHP_VERSION_ID;
Copy link
Member

Choose a reason for hiding this comment

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

If I understand correctly, this uses "the PHP version BR is running under", rather than "the PHP version of the code being analysed" as the default? What is the mechanism for overriding this? e.g. if we are using PHP 8.0 to analyse a codebase that runs on PHP 7.4?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kukulich kukulich marked this pull request as draft November 23, 2021 18:17
@kukulich
Copy link
Collaborator Author

Ok, tests failed because enums cannot be reflected - UnitEnum and BackedEnum stubs exist only in PHP 8.1.

…e able to reflect interfaces that exist only in PHP 8.1 stubs
@kukulich kukulich marked this pull request as ready for review November 23, 2021 18:42
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

LGTM - constructor used to define PHP version is also more than acceptable.

@Ocramius Ocramius self-assigned this Nov 23, 2021
@Ocramius Ocramius added dependencies Pull requests that update a dependency file enhancement labels Nov 23, 2021
@Ocramius Ocramius added this to the 5.0.0 milestone Nov 23, 2021
@Ocramius Ocramius merged commit 5cf886d into Roave:5.0.x Nov 23, 2021
@Ocramius
Copy link
Member

Thanks for keeping an eye out for the upcoming stubs patch, @kukulich!

@kukulich kukulich deleted the phpstorm branch November 23, 2021 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants