Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 23, 2024

we should not infer constant strings 1:1 when sprintf expects a format-width which can add padding characters and what-not.


fixes wrong constant value inference
https://phpstan.org/r/ea3080f4-f032-4f2f-8f3b-c5c0f0062da0
https://3v4l.org/HI0pE

We could make this more precise but I fixed only what is blocking #3475

@staabm staabm marked this pull request as ready for review September 23, 2024 19:27
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

Comment on lines +107 to +108
Copy link
Contributor Author

@staabm staabm Sep 25, 2024

Choose a reason for hiding this comment

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

the actual fix is here. everything else is refactoring/making code easier to read

@ondrejmirtes ondrejmirtes merged commit 31362eb into phpstan:1.12.x Sep 26, 2024
278 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the sprintf-refac branch September 26, 2024 07:03
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