Fix bug #79925 If the expected return type of a magic method is "object", we also need to allow class types and "static" to comply with covariance.