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

[CodeQuality][TypeDeclaration] Handle default value from constructor removed on InlineConstructorDefaultToPropertyRector+TypedPropertyFromStrictConstructorRector #3225

Merged
merged 3 commits into from Dec 20, 2022

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Dec 20, 2022

Given the following code:

final class Fixture
{
    private $url;

    public function __construct()
    {
        $this->url = 'https://website.tld';
    }
}

The moved value from constructor assign should not be removed, ref https://getrector.org/demo/082ad859-87da-4222-bc3f-b50bc1b3c101

Current diff:

-    private $url;
+    private string $url;

Expected diff:

-    private $url;
+    private string $url = 'https://website.tld';

Applied rules:

- Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector
- Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector

…removed on InlineConstructorDefaultToPropertyRector+TypedPropertyFromStrictConstructorRector
@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @stefantalen

@samsonasik
Copy link
Member Author

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

@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
3 participants