PHP – What does a function with boolean return values return, if it can’t return a boolean?

Let’s regard this function:

/**
 * @return bool 
 */
private function testThis()
{
    if(false) {
        return true;
    }
}

This will obviously not ever return its return statement.

What does this function actually return?

It turns out: This function returns

null

 

Leave a Reply