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

[ReadOnlyPropertyRector] Add failing test for cloned properties #1594

Closed
wants to merge 1 commit into from
Closed

[ReadOnlyPropertyRector] Add failing test for cloned properties #1594

wants to merge 1 commit into from

Conversation

internalsystemerror
Copy link
Contributor

Adds failing test for rectorphp/rector#6898.

Fixing this appears not to be a simple task (esp for a rector noob like myself) as I'm unsure how this is managing to figure out whether a property is written to or not.

If someone else wants to take over this PR, feel free. In the meantime I will continue to try to fix, if only for my own education purposes, but I don't want that to get in the way of this issue being resolved.

@internalsystemerror internalsystemerror marked this pull request as draft December 30, 2021 12:08
Signed-off-by: Gary Lockett <gary@creativecow.uk>
@internalsystemerror
Copy link
Contributor Author

My current working theory is that this line

if (! $this->nodeNameResolver->isName($propertyFetch->var, self::THIS)) {
is preventing the clone from being included in the list of property fetches.

@internalsystemerror
Copy link
Contributor Author

internalsystemerror commented Dec 30, 2021

I'm attempting to try and check if the type of the variable is the same as the declaring class (instead of just checking if the variable name is this). However, I'm at a complete loss as to how I can check the type of the variable.

I would be grateful for any insights here as I think I've reached my limit from just reading code.

@samsonasik
Copy link
Member

samsonasik commented Dec 31, 2021

@internalsystemerror I cherry-picked your commit at PR #1599

@internalsystemerror internalsystemerror deleted the hotfix/readonly-cloned-property branch December 31, 2021 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants