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

Constant string in str_repeat #6679

Closed
staabm opened this issue Feb 21, 2022 · 1 comment · Fixed by phpstan/phpstan-src#1030
Closed

Constant string in str_repeat #6679

staabm opened this issue Feb 21, 2022 · 1 comment · Fixed by phpstan/phpstan-src#1030

Comments

@staabm
Copy link
Contributor

staabm commented Feb 21, 2022

Feature request

When building sql queries, sometimes str_repeat is used to build IN sql-expressions.

$array = [1,2,3]; // our array
$in  = str_repeat('?,', count($array) - 1) . '?';
$sql = "SELECT * FROM table WHERE column IN ($in)";

Given constant arguments, str_repeat should return a ConstantString which would allow query analysis.

https://phpstan.org/r/33728aab-b9fb-4567-953e-0027dd26ee6b

I will work on it, just leaving it here so it is not forgotten

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant