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

Make handle @param duplicates and word boundaries correct #21

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

zonuexe
Copy link
Contributor

@zonuexe zonuexe commented Apr 30, 2023

resolve #20

// 1. the same position
if (! isset($paramNames[$key])) {
continue;
}

$typoName = $paramNames[$key];
$replacePattern = '#@param(.*?)' . preg_quote($typoName, '#') . '#';
$replacePattern = '#@param(.*?)(' . preg_quote($typoName, '#') . '\b)#';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

// 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;
Copy link
Contributor Author

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.

@zonuexe
Copy link
Contributor Author

zonuexe commented Apr 30, 2023

This comment is a note of a problem I noticed when working on this PR.


The README says that symplify/coding-standard is part of the Symplify monorepo, but it looks like that is no longer the case.


One of the complications in developing symplify/coding-standard is that ECS and symplify/coding-standard are dependent on each other for development.

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

@TomasVotruba
Copy link
Member

TomasVotruba commented Apr 30, 2023

Hi, thanks for the fix.
I've just confirmed the CI. Could you look at it and fix it? Ideally re-run test and Rector locally, so we have it fixed for sure and can be merged on next check. Thank you 👍

@zonuexe
Copy link
Contributor Author

zonuexe commented May 2, 2023

@TomasVotruba
This PR is ready. It contains a weird hack to get the tests to run correctly, but CI seems to pass. #21 (comment)

@TomasVotruba
Copy link
Member

Thank you 👏

@TomasVotruba TomasVotruba merged commit e000966 into symplify:main Jul 25, 2023
@zonuexe zonuexe deleted the fix/issue-20 branch July 27, 2023 05:27
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.

ParamReturnAndVarTagMalformsFixer incorrectly replaces both duplicated PHPDoc
2 participants