-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Make handle @param duplicates and word boundaries correct #21
Conversation
// 1. the same position | ||
if (! isset($paramNames[$key])) { | ||
continue; | ||
} | ||
|
||
$typoName = $paramNames[$key]; | ||
$replacePattern = '#@param(.*?)' . preg_quote($typoName, '#') . '#'; | ||
$replacePattern = '#@param(.*?)(' . preg_quote($typoName, '#') . '\b)#'; |
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.
Add \b
to make the pattern for $foo
not match $fooo
.
https://www.php.net/manual/en/regexp.reference.escape.php#:~:text=%5Cb-,word%20boundary,-%5CB
// remove correct params | ||
foreach ($argumentNames as $key => $argumentName) { | ||
if (in_array($argumentName, $paramNames, true)) { | ||
$paramPosition = array_search($argumentName, $paramNames, true); | ||
unset($paramNames[$paramPosition]); | ||
unset($argumentNames[$key]); | ||
} else { | ||
$missArgumentNames[$key] = $argumentName; |
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.
Make $argumentNames
a list to hold all arguments and add the wrong argument to another argument instead of unset
.
This comment is a note of a problem I noticed when working on this PR. The README says that One of the complications in developing Since the composer installed version of ECS bundles dependencies, the bundled ones will be preferentially loaded in PHPUnit executed from this project. It confused me that I changed the code and it was not reflected in PHPUnit. Luckily the problem was easily solved by creating a symlink like this: rm -rf vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard
ln -s $PWD vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard |
Hi, thanks for the fix. |
@TomasVotruba |
Thank you 👏 |
resolve #20