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

Support multi-byte string function variants #3039

Merged
merged 2 commits into from
May 9, 2024
Merged

Conversation

staabm
Copy link
Contributor

@staabm staabm commented May 3, 2024

No description provided.

@staabm staabm marked this pull request as ready for review May 3, 2024 10:21
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@rvanvelzen
Copy link
Contributor

Some tests with multibyte characters would be good as well 👍

@@ -25,7 +26,7 @@ class SubstrDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExten

public function isFunctionSupported(FunctionReflection $functionReflection): bool
{
return $functionReflection->getName() === 'substr';
return in_array($functionReflection->getName(), ['substr', 'mb_substr'], true);
Copy link
Contributor

Choose a reason for hiding this comment

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

The substr() calls below should be changed to use the correct function as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great catch, thx.

@clxmstaab clxmstaab force-pushed the nar branch 3 times, most recently from bcebb98 to 8d078f5 Compare May 3, 2024 12:12
@staabm staabm force-pushed the nar branch 2 times, most recently from 8cf4e2b to a7a57ba Compare May 4, 2024 04:52
@ondrejmirtes ondrejmirtes merged commit 80b46e3 into phpstan:1.11.x May 9, 2024
444 of 445 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the nar branch May 9, 2024 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants