I have found no information about this in the documentation, but it seems logical to exist. How to make a type hinting for a returning a value of object type? (I'm talking about any object, not a certain object of for instance \DateTime etc.)
function getParticipant(): ?object
{
//...
$x = new Cat();
return $x;
}
It is not working and what is really unfair is that print getType($x) will result in object. So we have an object type but can't say strictly that we will return an object?
You may say that it is really not necessary and I could have just written : Cat, but that's not what I need when I overwrite a method which has got * @return object|null */ in his PHPDoc.