-
Notifications
You must be signed in to change notification settings - Fork 472
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
Refactor PrintfParametersRule #3247
Conversation
This pull request has been marked as ready for review. |
public function getPrintfPlaceholdersCount(string $format): int | ||
{ | ||
return $this->getPlaceholdersCount('(?:[bs%s]|l?[cdeEgfFGouxX])', $format); | ||
} | ||
|
||
public function getScanfPlaceholdersCount(string $format): int | ||
{ | ||
return $this->getPlaceholdersCount('(?:[cdDeEfinosuxX%s]|\[[^\]]+\])', $format); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need this use-cases separated because I only need the getPrintfPlaceholdersCount
in PrintfArrayParametersRule
return []; | ||
} | ||
|
||
$formatArgumentPosition = $functionsArgumentPositions[$name]; | ||
$functionReflection = $this->reflectionProvider->getFunction($node->name, $scope); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was one of the few rules which did not validate the $node->name
via ReflectionProvider
.
I guess its not strictly necessary because we are handling php-src native functions - I added it for consistency.
Thank you! |
extracted from #3126
factor out
PrintfHelper
for later re-use in a to be createdPrintfArrayParametersRule