Is it just me or is this behavior weird in PHP. Lets say for instance that we have a function like this:
function test(object $arg)
{}
If I were to call this function:
test((object)'string');
object (the type hinting) would not refer to a stdClass and would result in an error even though object seems to be a reference to stdClass when looking at the built in settype() function in PHP. Even casting to an object would result in a stdClass but for some reason I can't use settype($foo, 'stdClass')...
Is there a reason behind this?