symplify / coding-standard

Coding Standard rules for PHP projects with focus on Clean Architecture
MIT License
347 stars 20 forks source link

ParamReturnAndVarTagMalformsFixer incorrectly replaces both duplicated PHPDoc #20

Closed zonuexe closed 1 year ago

zonuexe commented 1 year ago

Suppose you have code like this:

<?php

/**
 * @param string $one
 * @param string $one
 */
function someFunction($one, $two): void
{
}

The author's intention is to write a param for $one and $two, but it mistakenly duplicates $one.

I use SetList::CLEAN_CODE from ECS, but it seems to be replaced as follows:

 <?php

 /**
- * @param string $one
- * @param string $one
+ * @param string $two
+ * @param string $two
  */
 function someFunction($one, $two): void
 {
 }

ParamNameTypoMalformWorker::fixTypos() certainly seems to have that problem.

We don't want a quick fix as we can fix these manually, but will report them as issues. Thank you for your work!

TomasVotruba commented 1 year ago

Hi, thanks for reporting. Could you share bug fixture and fix?

zonuexe commented 1 year ago

Yes, I'm going to submit a PR tonight, so please wait a moment.