When a function is called you are asking the function to do something and return the result. When a function ends, it will return null unless told otherwise.
What your function is doing:
{
Am I this class? Return null;
Return null; //end of function. Does this automatically.
}
To be useful the return value needs to be specified, e.g.
{
Am I this class? return true;
Otherwise, return false;
}
The value of this return will then be the answer (true or false).
Starting with your code:
public function theFunction(){
if (get_class($this) == __CLASS__) return;
}
becomes:
public function theFunction(){
if (get_class($this) == __CLASS__) {
return true;
}
return false;
}
which can be refactored into:
/**
* Am I this class?
* @return Boolean
*/
public function theFunction(){
return (get_class($this) == __CLASS__);
}