Hi Nikita, Bob,

    https://wiki.php.net/rfc/typed_properties_v2
>

This is really well thought and written, sounds really primising.
I agree that "References without intrinsic type" look the best.

I anticipate one case on Symfony VarDumper that will break on typed
references:

the only way to detect references is by injecting cookies in arrays, e.g.:
$a = (array) $someObjectOrArray;
$cookie = new stdClass();
$b = $a;
$b[$k] = $cookie;
if ($a[$k] === $cookie) {
  // Here we have a reference
}

I'd need to wrap the assignation in a try/catch now:
try {
    $b[$k] = $cookie;
} catch (TypeError $e) {
  // Here we have a typed reference that doesn't accept stdclass
}

So far so good I suppose. I just wanted to raise the point if it matters at
all.

Thank you,
Nicolas

Reply via email to