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

Adapt PrivateConstantToSelfRector to work on non-final classes, too #3198

Conversation

alfredbez
Copy link
Contributor

Follow-up for #3178

Not sure about the change in the markdown files, part of it looks not unrelated to my change, probably someone forgot to generate that on main.

I'm not sure what to do for code like this:

<?php
class ParentClass {
	private const FOO = 'from parent';
	
	public function foo() {
		echo static::FOO;
	}
}

class ChildClass1 extends ParentClass {
	private const FOO = 'from child1';
}

I might add a check that changes static to self if all child-classes declare it as a private constant.

@samsonasik
Copy link
Member

The docs is generated weekly so you don't have too :)

@alfredbez alfredbez force-pushed the adapt-ConvertStaticPrivateConstantToSelfRector-to-work-on-non-final-classes-also branch from c16f092 to 1695135 Compare December 15, 2022 07:33
@alfredbez alfredbez force-pushed the adapt-ConvertStaticPrivateConstantToSelfRector-to-work-on-non-final-classes-also branch from 1695135 to 4815476 Compare December 15, 2022 16:15
@alfredbez alfredbez force-pushed the adapt-ConvertStaticPrivateConstantToSelfRector-to-work-on-non-final-classes-also branch from 4815476 to 36b84f1 Compare December 15, 2022 16:35
…onstantToSelfRector.php

Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
…onstantToSelfRector.php

Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
Copy link
Member

@samsonasik samsonasik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since it configurable, it looks good 👍

@TomasVotruba TomasVotruba merged commit 21c9e59 into rectorphp:main Dec 17, 2022
@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