While working in a project written by some one else ,there’s a Function which retrieves some Data’s and it’s return is the Array with Data.
function getSomedata()
{
//Get some data
return Array();
}
And on the code this function is tested in many Places as
if(getSomedata())
getSomedata();
Without editing every piece of code ,can i get notified from php if that Function is called from an IF Statement and return a Boolean instead of the Array with Data.
Theoretically, you could use backtracing to figure out which code called a piece of code and read and introspect the code to figure out if the function was called in an
ifstatement. But I’m not even going to go into the details of how to do this, because it’s utter madness.if (function()) function()is an anti-pattern, broken code, bad, bad, bad. You need to fix this misuse instead of fighting it with more madness. If that’s used in a lot of places, bite the bullet and fix it once instead of having to deal with it forever.