runkit icon indicating copy to clipboard operation
runkit copied to clipboard

Dynamically rename a class

Open JoyceBabu opened this issue 10 years ago • 3 comments

Is it possible to dynamically rename a class?

JoyceBabu avatar May 10 '15 08:05 JoyceBabu

It is, well it's methods:

http://php.net/manual/en/function.runkit-method-redefine.php

jnbdz avatar Sep 14 '15 14:09 jnbdz

@JoyceBabu I can add this feature at least for user classes, but we need to figure out how it should affect the class' objects, the class' succesors, their objects, code lines which use the class and so on.

zenovich avatar Sep 18 '15 18:09 zenovich

I have a similar use-case for testing purposes. I want to dynamically unload a class if it's already loaded into memory and then use class_alias() to alias another class to the same name. If I could rename the class with runkit, then, presumably, I wouldn't need to unload it.

ramsey avatar Mar 03 '17 17:03 ramsey