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

Implement IniGetReturnTypeExtension #2362

Merged
merged 2 commits into from Apr 24, 2023
Merged

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Apr 24, 2023

@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.

@staabm staabm changed the base branch from 1.11.x to 1.10.x April 24, 2023 09:24
@staabm staabm marked this pull request as ready for review April 24, 2023 09:32
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

$results = [];
foreach ($argType->getConstantStrings() as $constantString) {
if (!array_key_exists($constantString->getValue(), $types)) {
continue;
Copy link
Member

Choose a reason for hiding this comment

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

So what's the default return type? If we encounter 'unknown'|'max_execution_time', the return type from this extension will be wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch

@ondrejmirtes ondrejmirtes merged commit 7c5bbbf into phpstan:1.10.x Apr 24, 2023
374 of 377 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@ondrejmirtes
Copy link
Member

Although I don't understand how it's gonna help #2358 (comment) because for that key it's still gonna be string|false AFAIK.

@staabm
Copy link
Contributor Author

staabm commented Apr 24, 2023

I think precision can be added to the type list to make it return a numeric-string:

$ php -r 'var_dump(ini_get("precision"));'
string(2) "14"

$  php -n -r 'var_dump(ini_get("precision"));'
string(2) "14"

but thats something I would expect to be part of #2358

see also https://www.php.net/manual/en/ini.core.php#ini.precision

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants