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

Is there a way to know if a function/method is already patched? #24

Open
tomolimo opened this issue Apr 2, 2015 · 1 comment
Open

Comments

@tomolimo
Copy link

tomolimo commented Apr 2, 2015

Hello,
I would like to know if it's possible to call a function which will return true or false to indicate if the callable $function is already patched or not?
I mean to know if Patchwork\replace() has already been called for it.

Another question on the same topic is: what will happen if Patchwork\replace is called twice for the same callable?

Thank you,
regards,
Tomolimo

@antecedent
Copy link
Owner

Hello,

I will soon attempt to implement this functionality and comment on any obstacles that might surface. I suspect that they, if any, would be related to methods and polymorphism. Global functions, on the other hand, are the easy part.

As for the multiple patches for the same function, they would not displace each other but rather stack on top, where only the topmost one receives the call by default, but can then relay it to the lower ones through callOriginal (a misnomer in this case).

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