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

Update functionMap.php to fix return types and parameters #3726

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

vindic
Copy link
Contributor

@vindic vindic commented Dec 12, 2024

Fix for phpstan/phpstan#12148 (comment)

Fixing the signatures for the following functions :

apcu_cache_info()
apcu_sma_info()

And another one

strval()

setting the parameter value to mixed as defined https://www.php.net/manual/en/function.strval.php

Code snippet that reproduces the problem :
https://phpstan.org/r/f3e4b8de-f919-44d2-8b08-b979c5240693

Fix the signatures for the following functions :

apcu_cache_info
apcu_sma_info
strval
@ondrejmirtes
Copy link
Member

Don't change the strval signature, it's actually correct. To find out why, search the issue tracker.

@@ -12088,7 +12088,7 @@
'strtoupper' => ['uppercase-string', 'str'=>'string'],
'strtr' => ['string', 'str'=>'string', 'from'=>'string', 'to'=>'string'],
'strtr\'1' => ['string', 'str'=>'string', 'replace_pairs'=>'array'],
'strval' => ['string', 'var'=>'__stringAndStringable|int|float|bool|resource|null'],
'strval' => ['string', 'var'=>'mixed'],
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it was correct before, see e.g. phpstan/phpstan#9295 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, so the PHP documentation is incorrect, next time I will check the issue tracker first.

I have reverted and commit it again.

@ondrejmirtes ondrejmirtes merged commit e98335b into phpstan:2.0.x Dec 12, 2024
159 of 160 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

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.

3 participants