Skip to content

Conversation

@samsonasik
Copy link
Member

@samsonasik samsonasik commented Nov 29, 2021

Given the following code:

    private PageInterface $page;
    private SectionInterface $section;

	public function __construct(PageInterface $page, SectionInterface $section)
    {
        $this->page = $page;
        $this->section = $section;

        parent::__construct($page, $section);
    }

It produce :

-    private SectionInterface $section;
 
-       public function __construct(PageInterface $page, SectionInterface $section)
+       public function __construct(PageInterface $page)
     {
         $this->page = $page;
-        $this->section = $section;

which parameter $section should not be removed as used in parent::__construct()

Fixes rectorphp/rector#6822

@samsonasik samsonasik changed the title [DeadCode] Skip used in parent::__construct() on RemoveUnusedPrivatePropertyRector [DeadCode] Do not remove used parameter on RemoveUnusedPrivatePropertyRector Nov 29, 2021
@samsonasik
Copy link
Member Author

Fixed 🎉

@samsonasik samsonasik force-pushed the handle-remove-unused-promoted-private branch from 77ead80 to b60ebb5 Compare November 29, 2021 05:09
@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@TomasVotruba TomasVotruba merged commit 50bbdd1 into main Nov 29, 2021
@TomasVotruba TomasVotruba deleted the handle-remove-unused-promoted-private branch November 29, 2021 06:30
@TomasVotruba
Copy link
Member

Thank you

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.

Incorrect behavior of RemoveUnusedPromotedPropertyRector, RemoveUnusedPrivatePropertyRector

4 participants