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

ClassToStatic replacing to self, not static #31

Open
kokokurak opened this issue Aug 4, 2017 · 1 comment
Open

ClassToStatic replacing to self, not static #31

kokokurak opened this issue Aug 4, 2017 · 1 comment

Comments

@kokokurak
Copy link

Like said in the title, ClassToStatic pass is not working at all. It works just like ClassToSelf.

I'm opening this issue to ask what is the status of phpfmt? There are tons of bugs in this project, which makes it hardly usable. Also, the general design of passes and config hierarchy is confusing and just broken.

Are there any better alternatives to phpfmt available? Something that would actually work perhaps?

@MKCG
Copy link

MKCG commented Dec 5, 2017

Well, ClassToStatic extends ClassToSelf and was using a constant to determine the placeholder to replace.

So there is ClassToSelf::PLACEHOLDER = 'self' and ClassToStatic::PLACEHOLDER = 'static'.

But the ClassToSelf::convertToPlaceholder is using self:: instead of static:: to apply the change.

Ironic, isn't it ?

The change must be applied in the fmt.stub.php line 8324 :

				$this->tkns[$i] = [T_STRING, self::PLACEHOLDER];

should be :

				$this->tkns[$i] = [T_STRING, static::PLACEHOLDER];

I fixed this issue in another repository : https://github.com/MKCG/phpfmt_7-1

I'm starting to think that I should have made a fork in the first place.

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

No branches or pull requests

2 participants