Skip to content

more precise sprintf() return type on constant formats#1410

Merged
ondrejmirtes merged 2 commits intophpstan:1.7.xfrom
staabm:sprintf
Jun 14, 2022
Merged

more precise sprintf() return type on constant formats#1410
ondrejmirtes merged 2 commits intophpstan:1.7.xfrom
staabm:sprintf

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Jun 10, 2022

@staabm staabm marked this pull request as ready for review June 10, 2022 07:59
@kukulich
Copy link
Copy Markdown
Contributor

I think the regex is not complete. The printf format is %[argnum$][flags][width][.precision]

  • Argument number is a little strange for this use case but the support should be there.
  • Other use cases: https://3v4l.org/u0vgj

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Jun 10, 2022

I think the regex is not complete. The printf format is %[argnum$][flags][width][.precision]

absolutely. I did a first step with this PR which covers the initially reported issues.
I am fine with adding more coverage though, but the PR as is already provides value IMO.

@rvanvelzen
Copy link
Copy Markdown
Contributor

Do you think something like this makes sense as well?

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Jun 10, 2022

Do you think something like this makes sense as well?

I guess it depends on which use-cases the added complexity will cover. might be easier to think about it, when seeing actual NodeScopeResolverTest-cases

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Jun 14, 2022

@ondrejmirtes just rebased and it should be good to go

I will work on the mentioned features/comments in separate followup PRs regarding

Do you think something like this makes sense as well?

and

I think the regex is not complete. The printf format is %[argnum$][flags][width][.precision]

* Argument number is a little strange for this use case but the support should be there.

@ondrejmirtes ondrejmirtes merged commit ba8af60 into phpstan:1.7.x Jun 14, 2022
@ondrejmirtes
Copy link
Copy Markdown
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.

sprintf with float modifier is not considered as numeric-string on "subcalls"

5 participants