Skip to content

Conversation

@samsonasik
Copy link
Member

Fixes rectorphp/rector#9273

Note:

On multiple props on single property definitions:

/**
 * some existing comment
 */
private $thing1, $thing2, $thing3;

public function __construct()
{
        // first
        $this->thing1 = 1;
        // second
        $this->thing2 = 2;
        // third
        $this->thing3 = 3;
}

The multiple comments will be merged as is:

    /**
     * some existing comment
     */
+    // first
+    // second
+    // third
private $thing1, $thing2, $thing3;

then, phpdoc info will require rebuild by set it to null.I add $mergeExistingComments flag that set to false on mirrorComments method on AbstractRector to avoid regression on other existing rules.

@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @calebdw

@samsonasik samsonasik force-pushed the code-quality-inline branch from 07390d2 to bf9a79d Compare July 20, 2025 11:28
@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it to have faster feedback to test ;)

@samsonasik samsonasik merged commit baf984c into main Jul 20, 2025
47 checks passed
@samsonasik samsonasik deleted the code-quality-inline branch July 20, 2025 11:32
samsonasik added a commit that referenced this pull request Jul 21, 2025
…tor (#7074)

* [CodeQuality] Mirror comment on InlineConstructorDefaultToPropertyRector

* clean

* clean

* clean

* [ci-review] Rector Rectify

---------

Co-authored-by: GitHub Action <actions@github.com>
@github-actions
Copy link
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InlineConstructorDefaultToPropertyRector removing comments

3 participants