symplify/coding-standard

ParamReturnAndVarTagMalformsFixer incorrectly replaces both duplicated PHPDoc

zonuexe opened this issue · 2 comments

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!

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

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