Skip to content

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.

'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